The debate about leaving the EU was multi-faceted [1] - but a significant part was a kind of nostalgia for when Britain was indeed Great, and the idea that a UK free from the shackles of the EU could be great again. Take back control was the slogan - a complete misunderstanding of the difference between lost sovereignty and pooled sovereignty.
I see the same forces driving the US now as it undermines international organisations.
[1] and sure xenophobia played a depressingly large part.