You're talking about an incident involving a mark-39 bomb which was built in the 1950s, the same time period when USA ran reactors with a man wielding an axe to cut rope to drop control rods as an emergency shutdown measure.
We have come a long, long way since then in nuclear safety both in weapons and reactors.
The code you're talking about is the final step in a long sequence of events that requires positive authorisation from 6+ individuals from the president down.
By the time you've punched in the code, whether it's an OTP or seventeen zeroes, you've already committed a missile to a target and you're already 100% going to go through with the launch because two missile combat crew members turned their keys.
Russia doesn't even bother with these kinds of codes. Their second strike capability is fully autonomous and will launch even if all of c&c infra is destroyed.
This also has absolutely nothing to do with the mechanical intrinsic safety of the actual nuclear weapon during a fire or the RV that carries it. Which is the original topic at hand. The code is just an extra step to arm the weapon. The physical safeties are there to 99.999% guarantee that the weapon will not detonate unless armed. Even if you try really really hard to detonate it.
More thinking has gone into each tiny element of this process including the kind of paint used on bombs, than you have given to the topic as a whole.
We have come a long, long way since then in nuclear safety both in weapons and reactors.