The sovereign nation of Hawaii was violently overthrown by US colonists just 48 years before Pearl Harbor. Japanese intentions weren't noble, but destroying US military engaging in the colonial occupation of Hawaii was based.
It's hard to call any war by the US legitimate, even defensive ones, because they are defense of stolen land taken from people the US committed genocide on. Japan made no indication of targeting US civilians, they purely went for dismantling the colonial occupation forces.
US civilians were not under threat, the US colonial empire was.
US victory paved the way for US-backed fascist rule over tens of millions of people in South America, as well as US killing millions of innocent people directly or by proxy in the Americas, South-east Asia, and elsewhere, not to mention the exploitation and displacement of native Hawai'ians.
So no, I don't think the US cause was particularly legitimate. And before you talk about killing nazis - the US specifically did not want to go to war to kill nazis. There was a lot of nazi sympathy in the US, and after the war the US would go on to rescue many nazis through operation paperclip as well as advocate for the return of fascists to positions of power in Germany and Japan. The US went to war because their colonial empire was under threat, and that is hardly a legitimate reason.