"CEOs at large companies make a tonne of money. This is usually justified by saying that they are more skilled than the average CEO but this kind of skill is also hard to quantify. Why does this argument work for CEO pay but not programmer pay?"
Because it's much easier to measure performance of CEO's, at least artificially. If Google does well, then you (supposedly) know that Larry Page is doing well. That's how the market treats it, at least. But can you really tell me that you're able to tell me which of the 10's of thousands of engineers that Google has is responsible for that success?
Also, there's the issue of leverage. Just like a programmer can build software that is used by millions, and therefore has a lot more leverage and creates more wealth, so a CEO usually influences even more customers than the programmer. Paul Graham has an article about exactly that - the idea of a startup is to give e.g. programmers a lot more leverage than they usually have.
And arguably, the fact that a few engineers can build WhatsApp and earn billions is an example of that in action - getting more leverage by building a company, proving success, then gaining the money it gives. But the average exceptional programmer, while being 10X better at programming, won't necessarily also be better at business or money generation, etc.
Lastly, the fact that there are cases of companies colluding to keep pay down proves the opposite of your point - that salaries should have been even higher!