The North Korean constitution, AFAIK, justifies the building of a nuclear bomb as being in the interests of self-defense. Obvs they are unlikely to explicitly state that they are building one for the purposes of wiping out anyone else but the reasoning is sound. North Korea has nothing to lose and everything to gain for its long term stability if it acquires a measure of MAD, even just with its neighbours.