This was a plot device in the popular Fallout games. Where a city had built up around a nuclear bomb which failed to detonate during a nuclear war.
Are these still basically a soccer ball of explosives encircling a core of subcritical nuclear material that "just" needs to be compressed?
I think all of my knowledge of nukes might be based on https://en.m.wikipedia.org/wiki/The_Manhattan_Project_(film) xD
You can replace the timing and electronics mechanism prior to that network, but probably any sort of tamper resistant mechanism for a weapon will remove part of that network of switches if removed from the device. The rest of the controls are just too easy to replace to be effective at keeping someone from a roll your own type solution.
You're effecting physical operations (movement, explosions) on such tight timescales that the software becomes part of the hardware. You can't just run the code on a different setup: the code is defined by the hardware it's running on, because it's orchestrating the physical properties of the hardware it's running on.
As an analogy, think about programming early video game systems or computers, where a single clock cycle was critical. Is the software just software? Or is it intertwined with the hardware it's running on? (See: emulators having to mimic actual hardware performance)