I think this happens because people are not all living the exact same lives with equal opportunity to employment, healthcare, education, housing and money and successive governments (here and abroad) refuse to acknowledge this and respond to what people need. Eventually people get fed up of feeling like central govt doesn't listen and they look for change in the hope of getting improvement.
The EU was never this happy, totally united place and in the general panic about Brexit, a lot of people appear to have forgotten that there was actually quite a bit to criticise about it and it was very resistant to change from within. Initially we signed up to a trading agreement and what we got was something much more involved and I think that was always going to be problematic when you have one system for lots of countries who are in entirely different places economically and socially.