The problem with multi-player is that there is an immense amount of cheaters and trolls. It already was a problem fifteen years ago, nowadays game providers don't have another (realistic) choice.
The original Diablo 2 had a simple solution for this: Open Battle.Net and Closed Battle.Net.
On Open Battle.Net you could use your offline characters in online play, meaning you would run into a lot of hackers, but you could also play together with your friends online (there was also a LAN option). Closed Battle.Net meant your character was stored on Blizzard's servers, which prevented the most blatant cheating.
But starting with Starcraft 2 and Diablo 3 (and arguably WoW) Blizzard decided they could make more money by shitting their games up with always online DRM.
This is patently false since plenty of games (including (modded, "classic") Diablo 2) still have real online multiplayer, with multiple anti-cheater/troll solutions : passwords, (unofficial) game admins, (potentially official DRM-backed) player whitelists & blacklists (potentially shared across hosts), not advertising your game-hosting IP on popular matchmaker servers...
Please don't buy the "invasive DRM is good for you" corporate advertising - when (not if) the official servers shut down, these games will be crippled ! (We already had a taste of that with GameSpy, and it was only matchmaking servers !)
For what it's worth I agree with you that there should be a legal mandate for game companies to make their online servers available for public download once the official servers get shut down.
For the time in-between though... self-hosted servers are a niche market, and that is why companies don't care any more. Not enough players care to justify the expense, and ever since Hot Coffee and school shooters game companies have gotten pretty paranoid about moderation and fighting modders or bad press from raging cheaters. Again, there is no hope for the industry to fix that on their own, this is something that must be done by law.
You also still have games that don't even have any official game servers : Factorio for instance, and I guess "classic" modded Diablo 2 could be kind of considered to be it too since mods were never allowed on ("closed") Battle.net, only on "open" (not-)Battle.net ... (which IIRC only does matchmaking, while it's the player hosting the game that acts as the game server ?)
And Factorio has people setting up (usually renting in data centers ?) dedicated servers too (which then are at least accessible to everyone, unlike non-dedicated server games hosted on home networks where people not even bother to properly set up port forwarding any more, forgetting that not everyone relies on Steam to do the job for them...)
Cheating morons ruined the fun for everyone else.