“Ukraine’s mistake was giving up its nuclear weapons.”
The only way nuclear arms are a deterrent is if you’re committed to using them. Russia’s first strike would have been nuclear and the start of World War III.
What makes you think the Ukrainians wouldn't use nuclear weapons if they had them?
The Russians would not have launched an attack if a possible response was a nuclear bomb landing on Moscow.