What is the endgame here? Russia is outclassed by NATO both economically and militarily. If NATO intervenes economically, Russia will lose much. If NATO intervenes militarily, Russia will lose much (but at great cost to NATO). The risk of NATO intervention is high, right? Russia understood this before invading, right? So it seems Russia is accepting a high risk of loss. But it doesn't make sense that a nation as soph…
In essence Russia has chosen a Ukrainian hill to fight on, and that hill is no more eastward expansion of western powers/alliances or unions.
The more direct initiation of this conflict was the EU which was to enter into an Association agreement with Ukraine in 2013. When the signing of this agreement didn't go through you had the Euro Maidan protest in Ukraine and the Russian puppet government where thrown out as a result. In response to this Russia backed 2 break out regions in the east of Ukraine and annexed/claimed Crimea with sevastopol(navy base).
So the endgame here, no matter the cost it seems is that Russia defines Ukraine to be in its sphere of influence and will not accept any encroachment by western powers - so Putin is basically saying back off.
Georgia also tried to align itself more towards the west and agreed to become a NATO member and the Russian response was resolute back in 2008 as well.
Obviously there might be a number of other reasons, this is just what I have gathered over the years and I am by no means a expert.