I agree with you that over the past two decades NATO states have at times operated with a questionable level of unilateral assertiveness and while this behavior does not justify Russia'a actions, it nevertheless reduces the moral high ground from which these states can now criticize Russia. Now let me be clear, Russia's current actions vis-a-vis Ukraine are utterly indefensible and constitute as blatant a violation of international law as an old fashioned 19th century style land-grab. NATO's expansion certainly does not justify Russia's violation of the sovereignty and territorial integrity of its neighbors, not matter how vital Russia may consider its influence over those states to be for its national interests. Most importantly it should be recognized that NATO's expansion occurred as a direct result of the desire of the new member states to ensure their own security and in this sense it would absurd to condemn NATO for allowing these states to join the organization freely of their accord. Besides, how did NATO's expansion realistically pose a threat to Russia's security? Was there ever an even remotely plausible prospect of NATO invading Russia or otherwise directly challenging it militarily? The fact that some in Russia saw NATO's expansion as a direct threat was mostly the result of their anachronistic perception of Russia's role in the world, where Russia is still the same superpower the USSR used to be and NATO is its only serious challenger.
Having said all that, NATO states have also at times behaved in a way that has eroded their credibility as neutral arbiters defending the supremacy of international law. The best example of this was NATO's intervention in the Balkans, first in Bosnia and then in Kosovo. Whatever pretext they may have invoked of defending human rights and punishing internal or external aggression in ex-Yugoslavia, their actions often came across as being far from impartial and highly unilateral. Kosovo is probably the worst example of this. Before NATO's intervention many of the members states had labelled the Kosovo separatists (the Kosovo Liberation Army) as a terrorist organization, just as Serbia had done. Yet shortly afterwards when they considered the Serbian crackdown to be too harsh all a sudden these very same states made an about face and decided to actively support the KLA before essentially forcing the Serbian forces to abandon Kosovo. The fact that they then allowed Kosovo to declare independence and recognized it was highly questionable. Sure you can make legal arguments about how Kosovo is somehow an exception to the principle of territorial integrity because of the level of ethnic violence that marked the conflict, but that is a highly tenuous argument and all such exceptions ultimately weaken the general principle of the law in question.
It is also interesting that in the case of Kosovo, NATO actively barred Russian peacekeepers from establishing a security zone. The fact that after doing so they allowed Kosovo to unilaterally secede from Serbia with NATO forces effectively overseeing and enabling this process clearly enraged Russia. It's no wonder why Russia keeps bringing up the example of Kosovo as proof for Western hypocrisy on the sacrosanctity of territorial integrity in particular and international law in general.