Putin knows this. His enemies are weak and fighting runaway inflation. They do not have the appetite for war.
Putin will not tolerate having another enemy on his border. I presume he also expected for Ukrainians to capitulate faster. He has been demanding for Ukraine to remain Kremlin friendly or at least neutral since 2014.
As far as geopolitical YOLOs go, it was a decent bet. He took Crimea with little pushback, I presume he expected he could oust Zelenskyy swiftly or at least return Ukraine to a state of neutrality with little meaningful fallout from a weak West.
A video you should watch which elucidates why Putin is hostile towards a potential EU/NATO candidate being right at his doorstep: https://www.youtube.com/watch?v=JrMiSQAGOS4