If NATO/etc had abandoned Ukraine, and Russia had successfully taken it over - and maybe Belarus and Moldova next - then they might have been tempted to try attacking a peripheral NATO member to test if NATO really means what it says (whether or not they would have succeeded). NATO supported Ukraine to prevent that real threat of Russian military aggression against NATO.