Before I start, I would like to state that I would prefer a scenario or option of non-proliferation or nuclear disarmament. The havoc and devastation that nuclear weapons causes is jaw-dropping, as we saw with Hiroshima and Nagasaki during World War II. On the other hand, we have an oppressive despot that is unresponsive to economic sanctions or diplomacy towards disarmament or non-proliferation. Not only is North Korea not responsive, but North Korea's capabilities are getting better and better. There is a good chance that in the next few years, their ballistic missile capabilities will be able to reach the United States with accuracy (see current range below).
Right now, the balance of [nuclear] power in East Asia is that Russia, China, and North Korea are the ones with nuclear weapons. This is a nuclear version of "the bad guys have all the guns."As much as the United States and other developed nations have taken a stance towards non-proliferation, the truth is that we are looking at a bunch of unsavory options. Since North Korea isn't going to acquiesce if we ask nicely, the only way to stop North Korea before it acquires the desired capabilities is through military intervention (and even that is doubtful). Public policy is not about choosing some awesome option, but rather about choosing the least worst option.
One question is how would North Korea and its allies respond to Japan and South Korea acquiring nuclear weapons. Is North Korea pursuing nuclear weapons strictly for defensive purposes (much like it purports) or does North Korea has more nefarious plans in mind? If North Korea views nuclear armament as a way to protect itself, then Japan and South Korea acquiring nuclear weapons could either escalate the situation or create a situation of mutually-assured destruction (MAD). If North Korea has conquest or military conflict in mind, nuclear weapons would make more sense. Even if North Korea is not "suicidal" in the way you saw with kamikaze fighters in World War II, there is still room for miscalculation or elements within the North Korean military that could instigate undesirable outcomes. If North Korea is more unpredictable than the former Soviet Union was during the Cold War, it is going to be difficult to navigate this situation.
It is not just North Korea's response that is dubious. China is in a quandary. China won't meddle in North Korean affairs until it's too late either because it does not want to delegitimize its own regime or because China worries about North Korean retaliation. At the same time, China does not want Japan to have nuclear weapons, especially given China's history with Japan in the Second Sino-Japanese War. Plus, China does not want a scenario that invokes a U.S. military presence in East Asia. China is delicately walking on egg shells, to say the least. And as for Russia, it would benefit because it would reduce American power and increase its power in the region.
North Korea and its actors are not the only ones to have in mind. Japan has a particular aversion towards nuclear weapons because it is the only country that has experienced what nuclear weapons can unleash. When I analyzed South Korea and why the U.S. still guards the border, my concern based on that is that South Korea has been too reliant on U.S. help keeping North Korea in check. South Korean President Moon Jae-in stated last month that he doesn't want to pursue nuclear weapons because he doesn't want an arms race. At least with South Korea, they had nuclear arms on hand until 1991, so at least there is some precedence for South Korea.
Even if Japan and South Korea end up acquiring nuclear weapons, there is still a reality of international politics: alliances shift all the time. During World War II, the United States was allied with Russia until shortly after the end of the war. Afterwards, we had the Cold War. China went through a similar phase. Even now, take India as a more recent example. Historically, India was not particularly friendly towards Israel. Since the Modi regime, Israel and India have become closer than ever. Japan and South Korea have been allies to the United States for many years. However, Japan added Article 9 to its Constitution and took a more pacifist route precisely because of the havoc it reeked during World War Two. The reason I bring up alliances is that I would hate to see one problem be replaced with an even worse one, such as South Korea allying itself with China and sharing U.S. nuclear technology with China. Granted, Japan or South Korea have not given the world reason that they would develop military ambitions, but stranger things have happened before. Even so, there is nothing to indicate that this would end up being the case.
As long as North Korea becomes increasingly antagonistic, there is no easy decision on this front. This could go awry, and it could also become more difficult to persuade others to take a path of non-proliferation or disarmament in the future if we open this door. Nevertheless, based on what information we have, containment and deterrence are the best bet to keep North Korea at bay. Given that primary deterrence is preferable to extended deterrence, perhaps it is time for Japan and South Korea to have a modest stockpile, at least enough for second-strike capability. The U.S. is in no position to plausibly neutralize North Korea's missiles or prevent an initial North Korean attack on South Korea or Japan short of attacking North Korea preemptively. Although there are some risks to having Japan and South Korea having nuclear weapons, there are worse things than giving responsible, democratic nations a viable deterrent against a nuclear power like North Korea. I'll leave you with this quote from South Korean Saenuri party leader Won Yoo-Cheol:
"We cannot borrow an umbrella from our neighbor every time it rains. We need to have a raincoat and wear it ourselves."