However, this assumes that employment is fluid, and that people are allowed to choose a profession or trade that aligns with market signals and their own personal interests and preferences. In short, every citizen who considers becoming a developer int he valley is also free to become a plumber in Duluth or a lawyer in New York City. Or open a scented candle shop, or a surfboard shaping business.
The point of the H1B visa is to create a system where visa restrictions and sunk costs create a pool of workers who aren't allowed to make those choices, and are limited to a few fields where Silicon Valley CEOs have declared a "shortage".
And, astonishingly, many people talk about this shortage without discussing wages, work conditions, career stability, and the other options available to highly skilled people who can choose other professions (you know, those pesky free folk who just won't become developers in the valley at the rates tech CEOs have decided they should).
The US has a really grim history of creating non-free worker classes in order to undermine free labor markets. This is another installment of it, though the H1-B abuses, clearly documented and really bad, are nonetheless minor compared to some of these historical horrors.
You incorrectly imply that tech jobs will expand organically in a frontier-like or exponential fashion as happened in the past. That doesn’t actually happen in the tech sector. Tech companies seek to exclude alternative hire options from other STEM fields (engineering, science, etc.) because those alternatives would not be as cost efficient. Instead the tech jobs grow linearly (like most mature industries and systems) and only by the annual cap on visas being granted.
How you can tell that there is no absolute shortage of tech labor is that the number tech jobs never grows beyond the visa cap. If there were a shortage, companies would find more creative ways to exceed the cap limits like the above mentioned alternatives or creating training factories to increase the supply to meet organic needs/demand.
So while this mature system is not necessarily a fixed lump of labour, the mature constraints that apply seem to limit any organic growth to the current regime we find ourselves in. That is to say that companies constrain the tech labour system to their very skewed preferences instead of organic growth, and as a result the economic pie is growing less and less, and there is more and more competition over slice distribution. Incumbents are absolutely in direct competition with foreign labour and there is less overall growth to share equitably. Again, not a fixed lump of labour, but increasingly competitive to the point of very limited growth from within.
Every economist believes in supply and demand curves. If there are any H1Bs being awarded to replaceable programmers (as opposed to specialized programmers with no American counterparts, as was the intended use of the system), then wages are being depressed. It's practically a law of physics.