Putin did not occupy Ukraine in 2008 because he was unsure how NATO would react. The Minsk Agreements were not fully adhered to by either side, and gave Putin hope that if he played his cards slowly and surely he could take over Ukraine without any serious repercussions.
In 2014, he invaded and annexed the Crimea there were alot of Western protests, but little was done, so Putin, who is both a cat as well as a rat. decided to continue to play a waiting game until he felt confident that he could strike at Ukraine and occupy the whole country in a couple of days, then dare Nato and its allies to do something about it, feeling confident that they wouldn't.
One of the many things that last February's invasion showed as well as the incompetence of the Russian army was the incompetence of its intelligence services as well. Or rather, that they are not incompetent but that Putin and his immediate supporters were not listening to them.
Like so many dictators Putin is convinced that they are out to get him and he has cut himself off from all but a small group of yesmen, who know their position close to him, depends on their agreement with him, so they do.
He was convinced that Ukraine would be a walk-over, although intelligence suggested that was no longer true. He was convinced NATO would do nothing. He was wrong again.
Now he is stuck, he cannot go forward, but cannot go back, which brings us back to how rats behave when cornered.