So, that said: H-1B shouldn't exist for software. The point of it is to fill jobs that cannot be filled by an American for some reason; a condition that doesn't exist in software development. Hire immigrants as software engineers, fine. But find a way to do it that isn't bullshit.
I'd say most of foreign devs in the US are actually L-1 that is actually worse because L-1 prohibits the dev from changing jobs unless the dev gets a new visa.
H1B rules around changing jobs means that even if the employee joins at a market-level salary when they come to the US, they tent to stay at the same company much longer and can be exploited. The new company has to go through a lengthy paperwork process to allow the visa holder to switch jobs. Also, since the tech world tends to use things like stock options / RSUs / monetary bonuses for large parts of compensation package and those do not count towards "salary" you may have a situation where an h1b holder on paper seems to be paid fairly but in practice get only about 40-50% of what their peers get.
If they were allowed to change jobs freely they would be able to negotiate their compensation fairly. The companies would be less intensified to hire H1Bs to save money and would also consider local talent for same positions. Everybody would win: both H1B visa holders and their families and American workers, too. The only losers would be consulting firms (not a huge loss, to be honest, most of their employees are overseas anyway, so the can absorb the cost) and BigTech (they have enough money, anyway).
There are other problems for H1B holders, like getting a green card is something their employer, and not them, can do - another area for abuse. And then some nationalities have to wait much longer to go through this process then others (essentially, the US migration service says that the country has too many people from India and Pakistan already, thank you very much), and there are other issues I don't recall.