Arguably Khrushchev shouldn't have transferred the Crimea to Ukraine, but that certainly was no excuse for Putin's invasion.
The treaty that recognized the breakup of the USSR should have taken a moment to look at internal moves made during the Soviet era and determined if they reflected new national boundaries or the bureaucracies of the Soviet state. That treaty should have been the time and place to adjudicate the future of Crimea.
Good point, but one complication is that Stalin took measures by authoritarian means to change the demographics of Crimea, and Russianize it. That does not necessarily mean that one should try to put the genie back in the bottle, but it is a factor. I also read somewhere, I think, that if a referendum had been held in Crimea as to which nation they preferred to be a part of prior to Russia taking it over by force of arms, even though Russianized, the polls suggested that the voters would have picked the Ukraine. So that is another complicating element, if what I think is true, is in fact true.