What if the country in question decides to let them in, but without the proper documents, with the implicit goal of getting their labor for cheap? I think the principle of POSIWID applies here (the purpose of a system is what it does). In other words, the system is/was working as intended, and illegal immigration was desired.
All house doors/egress doors in Brazil require keys to unlock. BUT (and it’s a big but) most houses here are made of bricks, with ceramic roofs.
It does make sense to have easy-to-escape houses when they are built of flammable materials with an accelerant for a roof.