Then they hire H1B people who look good on paper.
This to me is a huge problem. And it upsets me greatly because its unfair and counter-productive.
Have you actually done hiring? The truth is that there really is a shortage of qualified applicants (at least, at existing prices). I've literally never met a fellow hiring manager who thought there was a surplus of good engineers.
I've also been a person applying to jobs, where I know I'm fully qualified (usually because I already do the same thing in the same way for a competitor) and where I'm told "we think your a good culture fit, but we're worried about your technical abilities". I can't know exactly why they said that, but when I've showed working code they say their happy with, but I know I struggled on their brainteaser questions, it feels safe to infer.
So, I've seen qualified candidates turned away because they were "unqualified" (but they really weren't), from both sides of the table. I'm not claiming there is a huge surplus of engineering out there, but there is no real shortage either. There are enough engineers, just not enough employers willing to hire them.
People always push it to the extreme and mention some very difficult algo question they were asked, and say how it's irrelevant. And if you have been asked a question like that, I agree it's irrelevant and that sucks.
But having a basic understanding of algorithms and data structures is important to writing decent software. Can we please stop pretending like expecting people to roughly know and understand the content of the freshman data structures course is some kind of unreasonable expectation?
For every 100 candidates a CS job gets, probably 80 are truly unqualified, 20 are truly qualified, but only 2 were both qualified and could pass an arbitrary list of brainteasers.
And that lie lets managers run around saying "see, we can't hire enough talent! Skills shortage!" (where "skills" means "brainteaser skills", not software development skills)