For US traders, developing-country stocks have been a surprising source of returns as Donald Trump’s trade war roiled the S&P 500 Index.