Most of those companies that failed failed (partly) because of the government
The government set the rules in regards the price cap, the very price cap that saw the companies forced to sell at below cost because they were prevented from charging cost+ as it would be above the cap
The moment the price started soaring and companies started having issues they should have abandoned the cap, or at least revised it.
Most of the debt was customer balances. If you stop the energy companies using those balances for purchasing energy then no one would pay in advance.
If no one pays in advance then the energy companies would be forced to borrow massive amounts of money, and the costs of that borrowing would fall on.... us!