And this can still be fixed by requiring above-market prices for H1B workers (eg. requiring 1.5x average pay for the position needed, so if an average compiler developer in california is paid 100k, you can only get a foreign developer if you pay them 150k - this would force companies to get local talent by raising their pay to 110k, 120k, 130k..., and when they really cannot get anyone, even at 150k, they are able to get someone on a visa).
But if you don't agree, take any example you like that requires at least a few years to come up to speed.
People aren't going to become an expert tomorrow on whatever subject you're hiring for, no matter how much you pay.
If you offered me a million dollars to play the trombone for you I'd love to accept that, but I can't do it until I go away and learn the trombone which would take me years. Offering me ten million dollars wouldn't make me learn it any faster, either.
We say that markets are 'inelastic' - they don't adapt to demand magically.
There are very very few positions, that you can't fill if you offer above-average pay and working conditions, and most H1B visa carriers now, are not unicorns, but usually just someone willing to work for less money than locals (example: https://www.nytimes.com/2015/06/04/us/last-task-after-layoff... )
But this can take decades.
If Google wants to start a large new compiler project, them opening a job position with a high salary isn't going to convince anyone to go away and do a PhD in compilers, and if it does they wouldn't be available for five years.
If Google want to build a compiler now and they aren't able to hire anyone locally with the skills, what do you want them to do? Abandon the project? That's not great for the US economy is it?