Isn't that the point of passports?
Historically, the point of passports was primarily to prevent people from leaving without authorisation. This mechanism can still be used, e.g. when a court forces you to surrender your passport.
In our age of paranoia about immigration, passports are also used the other way around: As a kind of guarantee that you can be expelled if need be. The country issuing the passport thus more-or-less accepts a duty to take you back.
To contain data and violations on each traveler, and that data is shared between all countries who "access" or scan the passport to make a decision on whether to admit them or not?
The passport, even a recent biometric passport, doesn't contain any data that would be updated after having been issued. The chip mostly contains the data that's visible on the ID page, together with a digital picture and potentially fingerprints. These data are encrypted with a key based on your biographic data. Currently, the only way information is added and shared widely is just through the good old-fashioned stamps you can check yourself.
Scanning the machine-readable area (the strip at the bottom of the ID page) serves two purposes:
- Reading the contents of the chip to detect any alteration of the document and compare the contents with the face and fingerprints of the person trying to cross the border
- Automatically pulling some data (like your name and date of birth) to run searches or even save it in some national systems or check if your passport is on some list of invalid document without having to type in the details manually
Do countries not share information about foreign travelers with all other nation states via their passports?
They mostly don't share information (by any means), with much more limited exceptions than most people seem to assume. It's easy to realize that the US, Iran, Russia, and Venezuela (to name a few) are not going to let each other access up-to-date biometric data about their citizens so you shouldn't expect some sort of worldwide system for that. Even within the Schengen area, where the principle of a central register of entries and exits has been agreed upon and the legal framework has been finalized for years, implementation is a significant challenge.
Note that all this is clearly distinct from information exchange for intelligence purposes. Collaboration between countries on this doesn't mean the data is widely available to all law enforcement officers. That's not how intelligence data is handled.