U.S. tech giants have been sacking employees in droves while simultaneously importing tens of thousands of foreign workers.