That's because the actual thing we are paying for is scarcity.
If there are 100 people willing to work hard, but we only need 90 of them, they will get paid little, because any of them can be easily replaced.
If there are 90 people with some rare skill, and we need 100 of them, they will get paid a lot, because any of them can easily find a new job. (In theory. In practice, the employers will take some coordinated action to prevent this.)
Ironically, doubling the productivity of the people with the rare skill could dramatically reduce their income, because now there are still 90 of them, but we only need 50.