But then it is legally hazardous for them to hire the foreigner

That assumes anyone is actually checking up on this. Enforcement is virtually nonexistent.

Except the point of the original post is that has changed.