The differences follow years of Republicans taking an increasingly isolationist view of America’s role in the world and Democrats supporting international alliances.