In the early days of the Ukraine invasion, one of the main lines pushed by Putin’s defenders was that the expansion of NATO posed a threat to Russia and that Ukraine was about to join. This didn’t stand up to even momentary scrutiny. The Baltic States had been members since 2004 without doing anything to threaten Russia.
And while Ukraine’s constitution included a goal of joining NATO, Zelenskiy was describing this as a ‘remote dream’ even before the invasion took place, and clearly indicated willingness to abandon the idea in return for peace.
But there is an important sense in which NATO shares responsibility for this disaster. The US intervention in Kosovo, including the bombing of Belgrade, was undertaken by NATO, to avoid the need to get the support of the UN Security Council, where Russia had a veto. This was a substantial breach of international law, followed by a much bigger breach in the invasion of Iraq.
At the time, there was general agreement in the ‘Foreign Policy Community’ aka ‘the Blob’, that
“The number one rule of the bi-partisan foreign policy community is that America can invade and attack other countries when vital American interests are threatened.”
This rule was implicitly confined to the US. In the brief period of US hyperpower, it could be assumed that the US, as sheriff of the global system, could enforce rules of non-agression against others, while also being judge and jury in its own actions. I argued against this at the time, pointing to the power of example, and was roundly criticised for my naivety.
But Putin was paying close attention, and drew the conclusion that if America was above the law, so was Russia.  The Kosovo precedent played a big role in his increasingly aggressive actions, culminating (so far) in the Ukraine invasion
Counterfactuals are tricky. Perhaps Putin would have acted in the same way, even without the precedent provided by NATO. But he was certainly encouraged by the sophisticated realists who dismissed international law as a figleaf.
fn1. Another participant in this debate, Glenn Greenwald, took the argument to its logical extreme and became a Putin backer, beginning with the invasion of Georgia in 2008.