Of course, our market is far from rational, etc, etc.
FWIW, I don't think that software developers are overpaid, at all. It's a difficult career, requiring years of intense study to do well. Sure, maybe not as much as Doctors, at least not formally, but a lot of that has to do with the structure of medical education in the United States (in particular, the requirement to complete an undergrad degree prior to admission to medical school). The job of a surgeon is certainly more difficult than the average software developer, but compared to a SRE at Google, say, who is working with real, "living" distributed systems that interact in complex ways, I would say they are comparable. If anything, I'd expect, in a rational market, for the SRE to be paid more, because their services are providing for millions or billions of customers, while the surgeon is only providing for one at a time (and maybe a few thousand over their carrer).
If I introduce a bug it will hurt revenue in some way, possibly affecting the company's operations. If most doctors mishandle a patient it could have significant, immediate effect on that person's life.
I deal with the responsibility weighing on me, but they've had to get used to dealing with a much heavier responsibility.
Think of Amazon, Walmart, or any firm with significant COGS [cost of goods sold]. It's clear that they can't hire employees inline with marginal revenue.
And what if the companies were to bid on the employee? That would likely drive wages higher and compensate for the natural information asymmetry in the tech labor market.
Compensation is set by the market: what is the next person who can do this same job willing to be paid?
If we go out into the market to find all the people that can decrease page loading time by 50% and have them bid against each other, we will probably end up paying the lowest bidder who is capable of the job about the median salary of the profession.
And another point on >the remaining $1.49 million gets distributed amongst execs and investors. People who own equity in the company have legal claim on the cash flows of the business. They balance free cash flows with reinvested capital (assets,, SGA) to sustain free cash flows into the future.