It is easier with other tech companies because unlike Musk they are/were generous severance time so those probably got 90+ days in severance time and the 60 days with say FAANG layoffs.
Also switching jobs can set them back on their path to permanent residency application timelines , depending on the country of citizenship that could be adding some years to continue on H1B and this dependency cycle so people close to their PR may try to stick it out
No one gets deported per se, most undocumented immigrants are people who fly over and overstay their visas, the USCIS will not check anything when they leave (by design so no one worries about leaving) however if they overstay the visa, it will be a tough time entering again , very likely to be rejected at the border or new visa application would be denied.