Looking in the map, the Ukrainian border is 510km(320miles) away and the next NATO border is 620km(380miles) away. It does not look like a huge difference.
Even now, Nato desperately want the kind of sane Russia back instead of going all in to topple it :-|
For me it is pretty obvious Putin knew. He also knew the west would let it go if he took it in three days or so.
Luckily he got his calculations wrong, Ukrainian resistance has been amazing and the public support for Ukraine has led to some of the strictest sanctions ever applied + voluntary boycotts + roadblocks etc.