I thought it would be cool to have my own TLD, but apparently it’s all managed by the ICANN, so you can’t just name your website with any TLD you want. There are different prices. But at least you can customize your second level domain. Why aren’t TLDs like this?
The issue DNS solves is the same as the phone book. You could memorize everyone’s phone number/IP, but it’s a lot easier to memorize a name or even guess the name. Want the website for walmart? Walmart.com is a very good guess.
Behind the scenes the computer looks it up using DNS and it finds the IP and connects to it.
The way it started, people were maintaining and sharing host files. A new system would come online and people would take the IP and add it to their host file. It was quickly found that this really doesn’t scale well, you could want to talk to dozens of computers you’d have to find the IP for! So DNS was developed as a central directory service any computer can request to look things up, which a hierarchy to distribute it and all. And it worked, really well, so well we still use it extensively today. The desire to delegate directory authority is how the TLD system was born. The host file didn’t use TLDs just plain names as far as I know.
At least in windows, the hosts file can point from any domain to any IP. In theory you can do things like point advertising domains to 127.0.0.1 if you wanted to make sure web requests never made it off your local machine. I did this a lot back in the day to test websites running locally but pointed to a friendlier name than localhost:randomport