On the Sunday after Donald Trump won the U.S. presidential election, sparking turmoil in emerging markets, J.P. Morgan Chase & Co. downgraded Indonesia’s stock market. The move set off a chain reaction that resulted in the New York bank losing Indonesia as a client.

J.P. Morgan tried to smooth relations with Indonesia, as it had done several times in the past. At stake for the bank was a lucrative and decades-long partnership. Bank executives spoke with officials through back channels, pushed for meetings and pointed to...