Honda posted its first loss since 1957 as it took a multibillion-dollar hit from scaling back its electric-vehicle plans.