There has always been clear red line; if NATO is attacked, we're starting WWIII. If a non-NATO friendly country is attacked, we'll complain loudly and declare sanctions.
Ukraine is not in NATO and we should've behaved accordingly (i.e, not sponsor a coup)
For what it's worth, what Mearsheimer is saying here about NATO expansion being destabilizing is pretty much exactly what Putin is saying in his various speeches.
But international law has a lot of influence. As a set of shared norms, it's something that most competently-run countries and polities explicitly foster in order to achieve some sort of long-term stability and predictability that ultimately benefits them all. A "realist" analysis that simply ignores these dynamics and pretends they do not exist is not very realistic after all.
I can observe an analogy of this for an individual person in a situation that he feels is life-threatening: criminal law or civil law are not the first things that come to mind but survival is. Only the one who first survives has a chance to return to law when things are settled back enough.
“Anarchy is what states make of it” is a great search phrase to pull on this thread with to say the least.
Should countries be able to get nuclear weapons just because they want them?
That’s on Russia, no one else.
The only way Ukrainian sovereignty leads to nuclear war is if the Russians are making it so.