The Soviet Union practically operated at one entity controlled by the party, but had multiple Soviet Socialist Republics inside it. And of course, before the Soviet Union existed, Ukraine was not a state of any kind, it was simply part of Russian empire.

Ukraine had a brief flirt with 'independence' after the Russian Empire collapsed and the Germans tried be the sponsor of new entity. Ukrainian nationalism was in its infancy then and once Germany was defeated in the East the idea of independent Ukraine was gone quickly. The allies had no interest in the (foolishly) no interest in the idea.

So basically practically speaking Ukrainian independence was never really a serious reality in basically all of modern Russian history. So for Khrushchev to move Crimea from one Soviet Republic to another was not a big deal. For him it was basically like moving some federal facility from one state to another in the US.

The way the Soviet Union collapsed was basically that the party lost its power, and then the individual states politicians realized that without party control they constitution would basically give them the right to succeed. Of course they did this based on the official borders initially.

This by itself was a very, very contentious issue when the Soviet Union was formed. Stalin actually strongly advocated against the idea of these Soviet Republics like Ukraine and wanted to integrate them into the Russian state the same way it was during the Imperial period. [1]

Lenin however was more willing to give nationalism a bone as first of all he knew the party would control everything anyway and he based on ideology believed that nationalism would simply 'not be a thing' once socialism was in power.

Stalin eventually build the Soviet Union based on Lenin lines from 1917 to 1924 as People's Commissariat for Nationalities. Interestingly enough even after Lenin was no longer capable to impact his choices Stalin did not go back and revisit it.

There were of course many different republics and autonomous regions inside of the Soviet Socialist Russian Republic and those all are still part of Russia today.

So Stalin was right to be wary of the nationalities, once they had an opportunity they did exactly what he feared and broke away and devolved communist party and the socialist institutions for the most part. That is also partly why in Russia today, Stalin is viewed more favorably then Lenin.

> why didn't they take it back from Ukraine when they split up, and why did they wait until 2014 to take it back

Because the new state Russia had little power and no money. In fact, even for any of these topics were relevant in the West Russia attempted in many places to roll the collapse, this lecture goes threw many of them [2].

The Russians did want it back very much and they brought it up in negotiations with the Ukraine and United states. However as they had no power to do much of anything about it. And the US had of course preferred as much territory to be removed from the core Russian state as possible, so there was no chance the US would side with Russia on this.

Like the Germans before them they also were interested in creating a Ukrainian state as a counter balance to Russia. The British tried much the same with the Republic of Texas.

The new Ukrainian government agree that the Russian Army/Navy would continue to use the base and of course Crimea was basically supplied from the Russian side. Practically speaking the Russian state and military had the power there.

Russia in the last 20 years regained a part of its former power, while Ukraine remains a basket case. Worst from Russian perspective is that US and the European have serious efforts to get Ukraine to be closer to them and politicians who became popular based on supporting that. This caused fears about long term viability of operating Crimea within Ukraine.

With this action Russia does two things at once, it makes it impossible for Ukraine to be integrated into NATO (as they did with Georgia) and they made sure that even if the Ukrainian state made serious turn towards the EU they could not influence Crimea in any way.

I hope this helps with understanding the situation.

[1] Stalin: Paradoxes of Power, 1878-1928

[2] https://www.youtube.com/watch?v=umIg0mrsZBs