>>>the Baltics are already in NATO. Ukraine joining would not significantly change the balance of power in the region.
Just look at a map. There's a reason "Turn the map around" is a mantra in professional military officer schools in the West: it's essential to understanding your adversary.
Russia's land border with Estonia and Latvia is ~325km long, straddling Lakes Peipus and Pihkva. This is a small frontage, and fairly easy for Russia's massive army to defend.
There is only 1 MSR/highway (M-9) that leads to Russia from these Baltic States, and the distance is just about 570km. The operational combat range of an M1 Abrams or Leopard 2 MBT is ~450km. So they can't reach Moscow from NATO territory without stopping to refuel a good distance short of the capital.
Now let's add a NATO-member Ukraine to the mix. Not even including Crimea, the Russian-Ukrainian land border is over 1200km long. That is a LOT of frontage to protect. It features 2 MSRs/highways with direct access to Moscow, 3 if you took a detour to secure Voronezh (not an easy task). If you use subsidiary roads from the closest part of Ukraine's border, before merging onto the M-3 highway, you can get to Moscow in about ~475km, JUST about the maximum range for tanks.
So Russia would be risking shorting the invasion distance to their capital by 20%, putting it in range of a mechanized lightning thrust. It would also massively complicate their ability to mass combat power on their border because their NATO front would quintuple in length. It would give the US the option of putting anti-ballistic missiles in eastern Ukraine, closer to potential Russian launch locations and probably making it easier to achieve boost-phase intercepts of ICBMs. That undermines the strategic deterrence balance of power/MAD. US ABMs in Eastern Europe is something Russian leadership has been bitching about for 15 years. For some reason we keep pretending to not consider their concerns legitimate.
That's a WHOLE lotta downsides. What is the UPSIDE, for Russia, of a NATO-member Ukraine, though? Pretty much nothing. So Russia's leadership did some risk mitigation calculus and they figured that immediate economic damage was more acceptable than the highly-negative long term Expected Value of a NATO Ukraine. Even if the probability of NATO attacking is low, the damage potential is astronomical. Keep in mind this is a country who's arguably most important holiday commemorates the war where they lost 25+ million lives fighting off an invasion from a hostile alliance on their western border. That's still in living memory for them.
Where they miscalculated was a) Putin's perceptions of the Ukrainian popular sentiment and b) their military's actual ability to pull off a nearly-bloodless blitz of Kiev to facilitate a regime change. The Russian military is looking hella-incompetent right now. I think if Kiev had fallen in <72hrs, there wouldn't even be sanctions against Russia today.