You could force the company to release their code upon bankruptcy, but what if another company wants to buy those assets? What if some other IP that they might use on other games is mixed in there and required for the game to work?
You could make a prohibition on live service games to begin with. You could require all games with online components to make their servers runnable by users from the outset. The problem here is economic.
Game companies can’t go back to the old model of lumpy cash flow. You can’t have one huge pile of money come in when the game launches, and then a long miniscule tail. That doesn’t keep people employed. It’s also super risky when a game with a huge budget and long development time flops. You have to have some kind of constant revenue stream from subscriptions or micro-transactions to stay afloat. If users can run their own servers, that can never happen.