We've had borders, passports, visas etc. in some form since the dawn of civilization.
Borders have not always been so precisely defined, and the strict, universal passport system we have today mostly came out of WW1
You can't just let random people wander into your country undocumented... If you did, it wouldn't be a country.
What is this xenophobic nonsense? As if physical geography, population, culture, and language have no inertia. But more importantly, why are you concerned with demographic purity as your defining characteristic for a "country"? Why is maintaining this segregation important to you anyway?