The part I don't fully get is how TLD servers, like .com work. Do they have a list of registrar DNS servers defined, and they ask them if somebody wants to resolve a domain they do not know about?
It works like this: Root -> TLD -> NS -> NS -> ETC.
Root Servers are fixed and everything drills down from there: https://www.iana.org/domains/root/servers
A visual example of how the nameserver hops work starting from the root using the nameserver delegation view feature of our dns lookup tool: https://www.misk.com/tools/#dns/news.ycombinator.com@i.root-...
(Disclosure: I work @ Misk.com, an ICANN accredited registrar, our link above)
The registrar will send a request to the TLD to essentially ask that they delegate your domain to a specified nameserver which will add records to the TLDs zone for your domain