Yes, hard borders are far more recent than people think. As late as the First World War you could travel the world without so much as a passport.
But: back then only a handful of very rich people had the means to do that, and taxation and social protection were much lower than today. Those things are related. They (IMO of course!) are what make borders a pragmatic necessity.
Passport equivalents go back to 1350BC
You could travel across the North American countries without a passport until quite recently. That only stopped being a thing after 9/11.