Electronic components can be swapped out. The nuclear material is what really matters.
The ability to fire the weapon matters too. You need a delivery mechanism.
Oh, those magical "Nuclear launch codes" - that turned out to be set to 0000 in the US or used a bike key in the Brtisih case ? Turns out being able to actually use the weapon in an emergency tops the codes not working.
Ok sure, I am not super aware of the intricacies here. But what does it matter?
That in the end it depends on the crew launching the nuclear weapon & the chain of command instructing them to do so. Having some codes is not sufficient - a whole complex process with many safeguards has to run to the end for things to happen.