Agree with everything but the last lines: there are tons of H1B visa holders coming from India who are by American or European standards rated at best as mediocre. Possibly 10% or less of all H1B Visa holding devs I would call highly intelligent and qualified.
Ever work with a software team from one of those places? Even a small project and you'll understand. Software dev isn't a linear process with lego block employees you plug in. It's not only possible but common for your top dev to be 20 or 30x more productive than your bottom one, and in fact it's very possible to have devs that create negative value because they write buggy software that no-one else can understand to either troubleshoot or extend later on. And that's before you start talking about language barriers (even Indian devs can't really write any ux without it looking odd to Americans), and the hours necessary to develop the specs with literally every conceivable item, and the rework when even that doesn't get you what you wanted, and the cost of not meeting deadlines, and....
There are great software devs in all those places. They aren't making the salary you listed and the best get hired on a visa to come work in the US. But the baseline entry level guys from a pedantic local school are in a different world. I tried offshoring twice, and now pay the market rate for my own in-house developers and am more than happy to do so. My only gripe is that we don't have enough of those good folks here for me to hire!