Here is a better solution: the countries foreign workers are coming from should do a better job of retaining them. When countries lose their talent, they are brain-drained and this stunts the growth of their own tech-sectors. Ideally, foreign workers won't want to leave their own countries because they should have high-wages and good opportunities at home.