TOKYO — Japanese automakers, like their global counterparts, have had a rough run in recent years, with the COVID-19 pandemic, supply chain mayhem, the war in Ukraine, rising inflation, higher interest rates and the breakneck race to plow billions into electric vehicles.