Capitalism derived from a class system whereby the lowly workers at the bottom work to feed the few at the top and keep them in their place of power and wealth.
Historically that was fed directly from an accepted class system where everybody knew their place but more recently with a burgeoning middle class the system started to collapse and the bottom rung needed to be filled from elsewhere and large scale migration was required to keep the rich and powerful in their box. This migration has meant large scale wealth sharing among the lower and middle classes while those at the top get wealthier and wealthier. This has bred huge anger, discontentment and tension between the groups who are most financially and socially vulnerable to this scenario.
Maybe instead of looking at the failings of democracy and why people want to leave the EU to limit migration and reduce the wealth distribution at the bottom we need to look at the huge failings of capitalism and address that instead. AIBU.