Your question isn't really about registrars, it's about the DNS system and how it works.
DNS can be quite difficult to understand when you start getting into the pointy end of it (GLUE records, etc).
When you purchase a domain, and you enter your nameservers, whatever you enter are created as what's called "GLUE" records. These records are, in laymans terms, "hard coded" in the registrar, as you have said (well, they're not hard coded, but that's the best way to describe it).
And the reason for this is, that when you go to
www.example.com, and the nameserver is
ns1.example.com, how the hell does it know how to find the nameserver, when the nameserver has the same damn IP domain as the website? The GLUE records, thats how.
When you look up
ns1 is a subdomain of
domain.com, so it looks at the
domain.com DNS to find out which IP address to map to (by going back to the GLUE record that the registrar for
domain.com has listed).
In short, ALL records you are looking at come from a DNS somewhere on the internet. Maybe it's a root server, maybe it's an authoritive server, but it's still a DNS server, not a registrar.