How is contact and address type linking created for doctypes?

We track something that is tied to customers, it is sort of a secondary account number, but there may be more than one per customer. We need the ability to search for this account programming ID and then get to the customer it is related to.

I tried creating a child table that would contain the newly created DocType, but it doesn’t link back to the customer. If I click on Menu -> Links, it just goes back to the table, not the customer.

How do I create a Doctype that has a link back to the customer the way that Contacts and Addresses do? How do I get that to display on the customers page?

I did find this question, which is specifically how to get addresses to show in a custom DocType, but it is the opposite of what I’m trying to do. I’m trying to get a custom doctype to link to the existing customer doctype.