Ukraine had the nukes in physical possession and they had enough expertise to eventually disassemble them and replace the electronics.
Choosing to not do this to avoid a hypothetical external aggression was a bad choice, because they were invaded anyway.