Remember: the attack on Pearl Harbor was a sneak attack on a Sunday Morning while Japanese diplomats in the capitol of the nation attacked were still actively pretending to be in a state of peace and in serious negotiations.
The Japanese intention was to issue formal notice that they were terminating negotiations and that further talks were impossible, effectively announcing an end to peaceful relations and declaring war, about 30 minutes before the attack, but they screwed up. Delays in decoding and preparing the message resulted in it being delivered about an hour after the attack.
An interesting twist here is that the US had broken the Japanese diplomatic code and was reading all of the correspondence between Japan and its embassy. Roosevelt knew Japan was breaking off talks more than 13 hours before the attack, and even before the Japanese ambassador did. So the US knew an attack was coming, though they didn't know it would land on Pearl Harbor. The assumption was that Japan would begin by attacking US forces in Southeast Asia. The commander of Pearl Harbor and other Pacific forces should have been notified of the change in the diplomatic situation well before the attack began, but bad assumptions and bureaucracy delayed that notification. Had that notification been delivered, and taken seriously, the Pacific battleship fleet would have been at sea when the Japanese bombers arrived, able to maneuver and fight back effectively, and US air forces would have been on alert and able to get off the ground and fight back. It's even likely the Japanese fleet would have been located and attacked.
Of course, US internal failures in no way affect Japan's culpability for not providing timely notice. The Japanese certainly didn't know that the US was reading their mail.
SOME Japanese made an effort to stop the fighting on terms favorable, and this would have preserved the Imperial Japanese Empire in the form that had been running wild across the Pacific theater mass-murdering the innocent - an absolutely non-starter negotiating point.
Indeed. The Japanese Empire had to be dismantled. Could it have been done without nukes? Sure. But definitely at much higher cost in American lives, and probably Japanese lives as well. The Japanese planned to send hordes of spear-wielding civilians to attack invading US Marines. It's horrible that many civilians died in Hiroshima and Nagasaki, blown up and burned and irradiated. But the alternative was to kill many of them in firebombings, or to machinegun them on the beaches.
We'll never know exactly what might have happened if the bombs hadn't been dropped. But what happened after Nagasaki was that the fighting ended, paving the way for what has, as you mentioned, been a surprising and marvelous friendship.