Sort of, NATO was practicing an method of economic and physical encirclement intended to suffocate the Russian economy. I don't personally think this was feasible but Russia has for about 2 decades and made their stance clear on this matter. If NATO continued on this path it would lead to war. Russia has stated this repeatedly and high ranking members of NATO have as well. Everyone involved knew this but to NATO's credit, they pushed those boundaries for a very long time and Russia never actually did anything about it. Mostly because it was not economically or militarily feasible.
Ukraine was the final red line though. Sure, morally speaking, one nation should not be able to limit the treaties another nation decides to make or coalitions they try to join but geopolitics is not governed by morality. It was stupid to believe that Russia would just accept Ukraine's entrance into NATO which is why no one in power genuinely believed this. Russia was not going to accept an alliance that allowed for a military buildup so close to their key infrastructure and ballistic missiles within a few minutes of Moscow. Russia fully understands that NATO is an imperial organ and necessarily a threat to its existence as a decently sized economy largely independent of it and brimming with natural resources.
Russia didn't "have to" invade Ukraine but if it didn't it would effectively look like rolling over to their largest geopolitical enemy and, strictly speaking, put them in a strategically compromised position.
This doesn't make it morally right or a great thing that I just fucking love but in the world of real politik it is rational. They weren't forced into this action but were put in a position where not doing it would be strategically untenable in the long term. The Russian ruling class is simply protecting their economic interests.
You don't have to be Russia's number one fan to understand this conflict as more complex than the western propaganda narrative that Russia is just an evil imperialist taking Ukraine because it wants to.