Using dkopi's example, at a company with 2M users, it's worth hiring a developer for each "penny per user per month" problem. A company with 1B users, it's worth hiring a developer for each "0.002 pennies per user per month" problem.
Or similarly, if you look at developers who work on internal tools that save other developers time. At a startup with 40 employees, each new tools developer must save everyone else two days per year. At a large company with 20 000 developers, each new tools developer must be able to save everyone else 6 minutes per year.
As the scale gets bigger, smaller and smaller problems become worth hiring people for.
Long term Efficiency versus short term gains is the issue.
A company like google can get away with this but not most.
The actual scale of the work certainly informs the compensation, like it might for other jobs like journalists for example, but that is only part of the story. If you need developers, you simply gotta pay them salaries the are competitive with what others pay for that particular role.