They dropped two nuclear bombs on Japan to make the Soviet Union's invasion of Hokkaido unnecessary and as a performative act to horrify the world in to subjugation.
The whole 'saved more lives than it cost' is a bad argument unless the plan was to slaughter a hundred thousand civilians on landing. Note the Nazi invasion of France cost 60,000 lives in civilian resistance...this was at the beginning of the war.
Japan would have surrendered on the first day of invasion.
It's hard to know what exactly could have been agreed on as a peace deal. The Japanese starting point was keeping everything they still had but they seemed willing to negotiate that away. You're right that "keeping the emperor" meant for Japan was keeping him as the "Sovereign Ruler" and exempt from prosecution. That being said, he was already a figurehead before the US came in and he wasn't prosecuted anyway. These could have been soft diplomatic understandings rather than something written down in the actual treaty. The US was willing to do that for the Nazis, making assurances about who would and would not be prosecuted.
Yeah and that's all correct, I'm just arguing that the reason for the bombs was not a proto-cold war move against the Soviet Union. I don't think the bombs or any targeting of civilians were justified at all, but arguing the proto-cold war reasoning is something leftists tend to zoom in on too quickly without researching, it is ahistorical and adds a layer of hindsight bias coloured by our own leftist bias that simply isn't necessary in order to to condemn the bombings.