Some corrections to your comment:
and (2) they do not need to provide relocation.
I could not follow this. Since when do they not provide relocation? Virtually every foreign student in my university who got hired by US companies was paid relocation. It'd likely be costlier (and illegal) for companies to have separate relocation categories based on citizenship.
In case you didn't know, most tech H-1Bs are not recruited from abroad. They're from within the US - graduating at US universities.
They cannot quit, they cannot threaten to leave otherwise they loose the green card. This process lasts from 3 to 6 years
First, the process can be much shorter if you're not Indian or Chinese - they have separate quotas. It's 1.5-3 years for most other nationalities.
Second, they can change jobs without disrupting their application if: 1) They stay in the same city. 2) The new job has more or less the same skills as the previous job. If you're an H-1B programmer in the Bay area, you're likely in good shape.