Yes, registrars have an agreement with the TLDs and have API access that allows them to submit requests for DNS delegation, transfers, registrations, creating glue records etc.
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