I think that the foundations for all that has happened to the U.K. during the past 7 years or so were laid from the very beginning of the Tory rule in 2010.
Cameron’s disastrous austerity, which did so much damage to the whole of society, particularly the NHS, housing, social care and so forth, meant that the effects were felt throughout society, and people looked for someone or something to blame. It laid the path wide open for opportunistic ideologues like the anti- Europeans to argue and represent the EU as the bogey man or scapegoat for the whole of the UKs ills.
It only took then, the right wing media and groups like the ERG to capitalise on this you have a society who desperate for change, willing to accept the arguments.
Cameron of course showing very little spine, caved into what in effect was a small minority and gave way to a referendum, but in doing so failed to set necessary parameters for such what would be a fundamental change to our economy.
He failed the country at every level.