Actually their invasion made a lot of sense in light of the reaction of the West to their invasion and anexation of Crimea - they did the deed, then Europe and American bitched and moaned for a bit and after a few years things were back to normal and Russia was selling their natural gas and oil to them in greater quantities than ever before (remember how well things were with Nord Stream after Russia invaded and anexed Crimea that they were building a second one and how dependent Germany had made itself of Russia gas).
To me it seems that the whole plan was for a quick decapitation attack on Ukraine (using their armored convoy targetting Kijv from Belarus), then endure a year or two of bitching and moaning by the West, then back to normal just like last time.
The very different results were product of 4 big surprises:
The Russian Army turned out to be much worse than everybody thought, including it seems the Russian leadership.
The Ukrainians stopped the armoured convoy at Irpin. This was in part due to #1, due to the merit of the Ukranians themselves and also due to how effective the modern handheld anti-tank weapons provided to Ukraine by the West turned out to be against an armored fast advancing into enemy territory as a very long column.
Zelensky turned out to be a great wartime leader.
The West reacted far more strongly and assertivelly than last time around. This was because, due to #1 and #2, the beheading attack failed and Ukraine became seen as capable of holding off Russia, which together with #3 made the Western power were willing to “invest” diplomatic, military and even economic capital into helping Ukraine (and even then the commitment started slowly and is still slowly increasing - just look at how long it took to authorize them to use Western weaponry against Russia proper or getting them F-15s)
Before those things were actually known, it absolutelly made sense for the Russian leadership to think that a military invasion of Ukraine to take it over had a high likelihood of success.