Of course it could also be in a database thingy for querying and stuff.
Some people say it is because Github wants to lock you in. I don't really believe that, but I am equally sure they don't mind if you lock yourself in.
Switching domain registrar and re-routing DNS is a simple and cheap thing if it ever becomes necessary.
Especially if you registered under a pseudonym, as then you can't prove legal ownership of the domain either. But even if you register under your real name, you may need a court case to compel transfer if the old registrar won't cooperate.
A sensible policy is to look at the risks you can do something about, try to assess how likely each threat is and what damage it would cause if it actually happened, and then make your plans taking into account how much you want to control those risks and what it costs you to do so.
On this scale, something like the total collapse of law and order or the failure of the core infrastructure of the modern Internet and its governance processes is obviously less likely than one commercial service provider pulling the plug on unspecified or unreasonable grounds.
We're not going to change the DNS registrar system overnight. But by drawing attention to the issue, we might, eventually, make it a bit more robust with regards to things like registrars becoming unresponsive to small players, or losing data.
For example if people could register with two or three independent registrars in order to have robust control and ownership in the event any one registrar fails them, that might help as a technical solution for robustness. No doubt there are other non-technical things that may help as well.
Separate from changing DNS, I think it's sensible to recognise that risks with cloud hosting or using SaaS, as happened to OP with their GitHub account, also exist with DNS, so for anyone who would find that a problem, they should evaluate whether relying on a single domain, or even on DNS itself, is the right thing to do. For example, high-value IoT devices in the field that can't be updated easily might look for their server at more than one DNS name, and specifically on separate domains (not subdomains) held by distinct registrars, and validate the server's identity. Or they might keep track of IP addresses that have worked recently (in addition to DNS) and fall back to those. (I have worked on devices where this was helpful because DNS on some deployed sites turned out to be unreliable.)
The culture and economics behind a lot of tech SAASes that we talk about here all the time make them inherently vulnerable to discarding or abusing users, even those who have been with them a long time and maybe paid them quite a lot of money, in the name of the almighty growth curve. The incentives there are not necessarily aligned with supporting even long-standing and loyal users.
In contrast, there is little to gain for a DNS provider to screw a paying customer or get embroiled in some tedious arguments about rights to some domain name. They can't entirely avoid that because of the environment they operate in, but they are generally going to make the most money when they have lots of happy customers who can briefly engage with the provider's almost entirely automated systems and pay some registration fees for the privilege through another almost entirely automated system and then everyone can get on with their day happy with the trade.
Yeah, but it's much, much, much less likely than some script at GitHub getting triggered and shutting your account down. And even the cheap hosting providers do have ultra-premium-platinum-support compared to Google, GitHub, Amazon etc.
It is an odd thing to think that GoDaddy may have more merit as a solution than Github for hosting code...
If you self-host your repository, you don't have a hosting provider. There is no-one to "pull the plug" on the server at my business's office except the people who work in the building who could literally pull the plug, and I suppose the electricity and phone companies and our ISP.
What you are talking about isn't self-hosting, it's hosting in the cloud on VMs you're renting directly. This is an intermediate step between self-hosting and using a fully hosted service like GitHub.
With cloud-hosting, you are probably still subject to the whims of your hosting service. For example, you might be subject to occasional forced restarts of a long-lived instance if your hosting service needs to restart or replace the underlying physical server.
However, in most cases, unless you're doing something illegal using their equipment or compromising their system in some way, these hosting services don't much care what you're running on your virtual box. This option is still far less risky than using a fully-hosted service, not least because you retain full control over the underlying data so there is almost nothing that can happen because of your hosting provider that a reasonable backup strategy can't fix within a relatively short amount of time.
1. Always have independent and automatic data backup. A storage medium attached to a raspberry pi is plenty enough
2. Always choose a setup that you can deploy and migrate trivially
It wouldn't matter what the hosting provider does if you have the power to pack up your bags and move elsewhere when they misbehave.