the system allows it because the bourgeoisie lobbies for it, then they come up with piles of nonsense to confuse people with.
the solution is not in being mean to immigrants, it's in making sure that the labour code is enforced, which means you have to hire people legally and you have to pay them legal wages with legal benefits and you face consequences if you don't.