1. Applicants being hired directly by US companies like Amazon, Google, Microsoft etc. These applicants have either worked for a while at one of their offshore subsidiaries or were hired directly after a thorough interview process. They are typically paid on par with their US counterparts. These applicants are usually very good at what they do — regardless of their educational background — which is why they were hired in the first place.
2. Applicants working for outsourcing companies who are being sent to work for their clients. Unfortunately, not all of them are good and are hired mostly to reduce costs.
Most of the stereotypical immigrant engineers fall in the second category. A lot of them moved to the US in late 1990s and throughout the 2000s. Companies like Microsoft, Amazon, Google, Apple etc. don’t typically hire incompetent people — barring a few exceptions which may have slipped through the cracks.
Unfortunately, the second category of applicants give all of them a bad name.
I don’t know exactly how this can be solved completely. Perhaps H1Bs should be allowed to stay in the country after quitting their jobs for a certain period of time so they can look for another one — eliminating low employee mobility? Perhaps the minimum H1B wages should be increased — eliminating the low cost H1Bs? Perhaps there should be additional scrutiny for applicants going to work for a third party client? Perhaps there should be subcategories of H1B with different limits for the two types of applicants? Perhaps a combination?
In any case, treating the two categories as one is probably not a great idea.
[1] I know I am generalizing here and that the world is not black and white and that there are exceptions. But in my experience, these are the broad categories.