Foreigners don't vote, so there's little democratic incentive to treat them well. And if you need a visa, the country has already put you in the "undesirable" category (tourists from desirable nations can visit without visa).
No, democracy is just a buzzword. Its _political_ incentive. Just look at southern border. You can go to Mexico, pay some shady smuggler gangs decent sum of money and you can enter in US in no time. Same goes to those “humanitarian boat” arriving from Libya to Greece for EU.
At this point, illegal immigration is much easier than legal ways.