You can trace it back further than that. If Cameron had never agreed to a referendum in the first place then no amount of pontificating and bullshitting from Farage would've made a difference. Cameron is the one who set the ball rolling. Even Blair was wise enough to renege on a pledge to hold a referendum on EU membership.
I think it can be traced back one step further.... and Nick Clegg is really to blame. (Although how far back can one go)?
When Cameron was in government with the Lib-Dems (2010-15) they kind of kept him in check up-to-a-point. As Cameron campaigned for the 2015 GE and promised a EU referendum, I actually think he did so not expecting to win an overall majority.
The problem was, Clegg had disappointed so many people whilst sharing power most specifically reneging on the promise to not initiate tuition fees for University students.
Cameron won an outright majority. He then felt obliged to stick to his manifesto promise.
Nick Clegg buggered off to America.