The Germans were close to developing the technology before the Nazi regime was defeated, and although the Japanese turned out to have been far away, the Allies had no way of knowing that 70 years ago. They did what seemed imperative at the time: stopping Japanese military expansionism, the fascism of the rising sun, before it was too late to do so.
Dropping the bomb is a harsh but possible method of stopping proliferation; banning the bomb through international treaties is not. Ban-the-bomb campaigns and negotiated agreements ensure only that the most aggressive and fanatical regimes possess the most destructive weaponry.
The result of nations agreeing to actually abide by a ban-the-bomb treaty would lead to no nuclear weapons in the hands of any but rogue nations, such as North Korea. It’s unnecessary to spell out what that would mean. The law is a great instrument to use against the law-abiding. Using it against the lawless works only in conjunction with force, which is what you give up when you disarm yourself hoping that the lawless will follow suit.