Matt Levine has a good explanation (https://www.bloomberg.com/opinion/articles/2022-10-31/elon-m...), which is that they receive a golden parachute for a simple reason. Their self-interest was to say "la-la-la, we can't hear you" when Musk comes trying to buy Twitter. That would've given them a chance to maintain high paid positions for years. Instead, they sold to him, knowing they'd probably be given the boot.
Now, at some level, it still stinks that the CEO is getting paid so many tens of millions of dollars for less than a year's worth of work. To solve that, you'd have to cut CEO pay in the first place, because just removing the parachute would incentivize clinging to their existing paychecks.
The C suite has an incredible amount of influence to block a deal with a non-strategic acquirer like Elon. The threat of all executives resigning en masse can knee cap a business.
Now, at some level, it still stinks that the CEO is getting paid so many tens of millions of dollars for less than a year's worth of work. To solve that, you'd have to cut CEO pay in the first place, because just removing the parachute would incentivize clinging to their existing paychecks.