Mr. Trump’s conflicting goals — trying to make China a fairer place for American companies to do business while simultaneously punishing companies that are operating there — are threatening to turn what began as a limited skirmish into a drawn-out and costly quagmire, with little sense of how the United States or China will retreat.

“For those who supported tariffs as a tool to bring the Chinese to the table to reach a big deal, all of this now seems beside the point,” said Scott Kennedy, a China expert at the Center for Strategic and International Studies. “It’s pointless casualties. And those pointless casualties will be the companies whose exports are eliminated, and consumers who will pay more and have less choice.”

Mr. Trump could still reverse course if China makes concessions — or if the American economy weakens and shows signs of slipping into recession, particularly as the election nears.

But so far, there have been few signs of amelioration, only strident statements. Major gaps remain between the two nations. An initial discussion in Shanghai in July prompted no breakthroughs, though the two sides may meet again in September.