Basically, the idea of the Schengen Agreement was to make travel - and employment - within European countries as easy as travel and employment between states of the US or between provinces in Canada, etc. Even though Schengen was mostly implemented in the 90s and did not include Switzerland, the Swiss voted (by referendum, which is the usual major decision-making technique here) in 2005 to become part of Schengen.
This is one reason why my unfortunate friend got caught up in her expensive dilemma. She moved from here to Thailand in 2003 and had not realized how Switzerland's joining the Schengen area during her absence might also affect residence requirements in Schengen areas.
The UK and Ireland, both EU members, had opt-out provisions. These opt-out provisions are not available for new members of the EU, however. https://en.wikipedia.org/wiki/Schengen_Agreement#History
More recent EU members, primarily from Eastern Europe and often with questionable histories of treatment of their own minorities (culminating in significant collaboration with the Nazi Regime in the 20th century to send their own Jewish and Roma minorities, among others, to concentration camps/gas chambers) are not happy about the Schengen requirements - as evidenced by the RW in Poland, Slovakia, Hungary, and Czech especially. Shame on them, IMO!
People too often focus on the open borders aspect as a minus. They conveniently forget its other aspect: to provide equal opportunity and footing for all EU nationals in Schengen countries, which is why it is much easier for Schengen-area nationals to be employed anywhere in the Schengen-EU area than it is generally for non-Schengen-non-EU nationals, including US citizens.
In my friend's case, this made a significant difference for employment. Prior to 2005, she was able to teach courses on a part-time basis at the Geneva branch of Webster University, even when she was not a resident of Switzerland. After 2005, she no longer had that option because the University would have had to make a specific determination that she was more qualified than any Schengen Area national. This would have been very difficult to do since she taught humanities courses rather than scientific or technical courses.