Joining NATO was unpopular until 2014, but even before 2014 (in fact at least since mid 00s) the majority was already rather in favor of EU vs some EU-like union with Russia. But of course it was more like 60-40 (and majority still wanted to maintain good relationship with Russia at the same time and had a generally positive view on Russia). Which became more like 80-20 after 2014 (with views on Russia becoming more negative) and almost 100-0 after 2022.
So It is important to understand that while in general friendly to Russia, Ukraine was already trending in the direction of EU long before 2014, just gradually - and with of course wide regional (and age) differences. Even Yanukovich had to run on pro-EU platform in 2010 since he had no chance to win otherwise. And when he made an u-turn to align with Russia against the wishes of the majority of the population, he lost power.
What is stunning is actually how little accurate intelligence on Ukraine reached the upper echelons of Russian power. There were lots of assumptions they made that even a casual observer of Ukraine with at least some degree of impartiality could immediately flag as completely wrong. Such as the assumption of the vast majority of population in all territories apart from the western Ukraine being more or less pro-russian and welcoming or not minding Russian rule, armed forces except a couple of "nationalistic batallions" not resisting/changing sides etc.
What is even more outrageous, is the fact that before the war there was a poll of ordinary Russians - and the majority even of Putin's supporters (!) correctly said that Ukraine would resist and that their population wouldn't be happy about the invasion of Russia. Just shows you how out-of-touch with reality Putin became.