I don't think that's how capitalism works. Your pay doesn't scale with your value, otherwise teachers and firefighters would be making bank. It's completely guided by supply and demand.
EDIT: Let's consider that "supply and demand" has artificially increased the price of programmers above their value. It's now a losing proposition for a company to continue to employ a programmer as the company is losing money, so the demand goes down and with it the price.
Conversely let's consider that the price of a programmer is artificially lower than his value. Any new company can come along and pay a bit more (but still less than actual value, for now!) and attract the best programming talent. Other companies must keep up in order to keep the talent, so the price returns to the actual value to the company.
Uh, no, that is not how supply and demand works. See <http://en.wikipedia.org/wiki/Economic_surplus>.
The gap between what people are willing to pay vs. what people are willing to sell for is often substantial. People spend a lot of time fighting over the distribution of the value in that gap between consumers and producers (see, e.g., price discrimination).
Replace x with "fair salaries" and "y" with "Tech companies making non-poaching agreements"
The CEO is essentially the face of the company when things happen (good or bad) and has huge responsibilities. Managing a company is easy from the armchair.
As far as lawyers are concerned, their wages just reflect the fact that they (should) have been trained as A-list negotiators, and it is common practice for lawyers to have a fee based on a percentage of the deal they negotiated.
There is a corollary for programmers for the above: start-ups. Though not trained negotiators, skill and work ethic can get you far enough. And it is common practice to receive a percentage of the reward.
The grass always looks greener on the other side.
From the company's perspective, whatever an individual put into their experience is almost completely inconsequential if they are doing their job. In a healthy, functional market, pay isn't about "fairness", it's about bottom-line results, and programmers and engineers make the products and services these companies use to generate revenue which in turn creates demand and subsequently the available funds for legal counsel!