I am not so sure if I would have given up those nukes if I were in the position of those smaller states. I would probably would have kept them if I were in their position. However, from the perspective of the interests of NATO, it's debatable whether having all those nuclear armed states would threaten it's security. I would have to think long and hard about it. There are trade offs and benefits to every decision. If you encourage these smaller countries to disarm and give up their nukes, they then become easy prey for larger, stronger countries. These smaller countries, I would think, would be aware of this. There is a risk for NATO not encouraging the smaller countries to disarm their nukes but on the other hand, their could be risks for NATO by encouraging these small countries to disarm and give up those nukes too. You have to look at which risks pose the greatest threat to NATO from the perspective of NATO security and choose accordingly.
The Russia and Ukraine of 2021 are quite different entities from the Russia and Ukraine of 1991.
Where I have difficulty with what you believe Ukraine should have done in 1991 is that it is based, if I am reading you right, on a projection of the Ukraine of today unto the Ukraine of 1991. Nor does it take into consideration the kind of transition the Republics of the USSR wanted.
But what I think is problematic is the assertion that Ukraine gave up her nukes. If the nukes were truly Ukraine's then it was a mistake to give them up. But were the nukes Ukraine's?
The nukes were based around the Soviet Union, on the territories of various Soviet Socialist Republics, of which Ukraine was one. But the nukes belonged to the "Federal" Soviet goverment. Same as nukes based at Minot Air Force Base, N Dakota belong to the Federal Government of the United States, and not to the State of N Dakota.
The command and control of nukes based in Ukraine was never under the control of local Ukrainians. They were under the control of Moscow. It is fair to assume controlled by Russians, as Russians dominated.
Now if we have to speculate:
Would the nuclear weapons not have become a sticking point in the move towards independence from Moscow? You have to also assume that a push by Kiev to retain hundreds of nukes would also have raised the suspicions of Russians. One also has to speculate that the more Ukraine pushed for a share of the nukes, the higher would have risen Russian suspicions. Dont forget that even then there was still uproar over Crimea and Sevastopol naval base among other things. In the end they both worked something out which at the time satisfied both.
Would it have been better if the collapse of the Soviet Union went the way of Yugoslavia?