Or to take a more concrete example, if Elon Musk decided to quit Tesla in a huff and focus entirely on X and stop dealing with the annoyance of public markets, the stock's would probably lose $75 bln in value overnight. If your legal goal is to maximize the company's value and it takes $500 mln pay per year to keep that from loss happening, it seems like it's probably a good deal to just pay the $500. As another example, Steve Jobs received hundreds of millions in stock options, and that was probably an excellent deal for Apple, though they probably could've hired someone cheaper.
I agree there are many cases where a more expensive CEO is actually worse. But I think it is very very easy to imagine cases where it makes a ton of sense to pay a large amount for an expensive CEO if they are the right person for the job and will add 10x more value than their pay.