How did Ukraine, Uzbekistan, Kyrgyzstan etc from or were they previously formed during the russian empire?
One of the big questions all modern governments of Russia have faced is to what degree the minority areas will govern themselves, and to what degree then will be governed from Moscow or St. Petersburg. During the Russian Civil War the Whites were for a "United indivisible Russia" and the Reds were for giving the minorities autonomy as long as their governments were Communist. The Reds won, and Soviet Russia was reconstituted as a Union of Soviet Socialist Republics aka the Soviet Union. Soviet Ukraine was one of the founder republics of the Soviet Union.
Now, there were too many ethnic groups in Russia to give each its own Union republic, so smaller ethnic groups settled for "autonomous republics" within the Union republic. There was little consistency between them: the Tatars numbered many more than the Estonians, but the Tatars only got an autonomous republic and the Estonians, when their country was annexed to the Soviet Union, a Union republic. Soviet Central Asia was originally two autonomous republics within the Russian Republic, plus two more "People's Soviet Republics" on the sites of two Central Asian protectorates of the Russian Empire (similar to the princely states within British India). It was reformed in the 1930s into five Union republics, two of which were Uzbek and Kirghiz Soviet Socialist Republics.
When the Soviet Union broke up, the new states have mostly inherited the borders of the old Soviet Union republics. Russia's recent annexation of Crimea is an exception.