1. The amount that a company can sustainably pay you is dependent on how much value your efforts have in its industry. Software has significantly higher margins than medicine, law, or almost anything else. As long as those margins are sustained, it is possible to pay high salaries. (As buffet says: I'd rather work for a mediocre company in a great industry than a great company in a mediocre industry).
2. But companies don't want to pay high salaries, so they will look for substitutes. Substitutes could be technology (RDS instead of DBAs) or increased supply of quality programmers. So far, it seems like these big companies haven't been able to find good enough substitutes to force down wages.
3. If you are looking at FAANG salaries, you are looking at the top of the income spectrum. The top of the income spectrum for lawyers and doctors is quite high.
4. Market economies reward value (outcomes) not merit (hard work). Hard work is correlated with outcomes, but it is not always a perfect correlation. So, looking at programming and saying it is less 'hard' than law or medicine doesn't say much, the question is how much value the person can generate, and how much of it the company can capture.