Econ 101: increased supply lowers prices (wages).
Thats some Wealth of Nations every worker can move the same number of bricks reductive thinking.
I have been in the valley for 25+ years, and worked with a ton of visa holders.
The majority of them were better educated and all well compensated for the work they did. The fact that many of them stayed for green cards and citizenship says a LOT. There is a reason that the boss of both google, and MS came through these programs.
A healthy labor pool increase business growth that in turn can push average industry wages higher however.
It’s real phenomena too - US developer wages are so high in part due to the business ecosystem which depends on part on recent graduates and a flexible labor pool.
That is, your analysis is only true in the static case. Starve US startups of talented junior developers and you might kill the next Facebook in the process.