Look, if I murder my neighbor because they’re friends with the other neighbor I hate, I’m the bad guy.
Russia does not get to tell other countries they aren’t permitted to ally with each other.
Logically, no - they don’t. In the real world, it does not work that way. Hence, the US has the Monroe Doctrine. It’s also the reason why US has invaded Latin American countries and many other ones. “Might is right” is an unfair unfortunate realty in international military situations.
It goes back way earlier than that. Russia has repeatedly expressed in no uncertain terms that Ukraine is the single one red line that they will never accept joining NATO. A very insightful article on FP on the topic:
https://foreignpolicy.com/2022/01/19/ukraine-russia-nato-cri...
Please see my earlier comments for why this but-NATO! argument is the opium toked by demagogues and their acolytes.
If NATO told Ukraine from the onset they will never join NATO steps 2 and 3 would not have happened. Which means step 6 would not have happened. [edit - a typo in the numbers in events sequence. Sorry about that]