Not content to leave it there, Mr. Trump proceeded to try to unilaterally dictate to the private sector how and where it should conduct business, presuming a role in the marketplace that no other president has asserted in similar circumstances.

“Our great American companies are hereby ordered to immediately start looking for an alternative to China, including bringing your companies HOME and making your products in the USA,” he tweeted.

While White House officials said no such order was being drawn up and it was not clear how it would be justified legally, at least without an act of Congress, a president does have an array of tools at his disposal to make it more difficult or costly for businesses to remain in China.

Shaken as both China and Mr. Trump again raised tariffs in a tit-for-tat exchange on Friday, stock markets fell sharply. The president turned that into a laugh line at the expense of a Democratic congressman from Massachusetts who ended his bid for the presidency on Friday.

“The Dow is down 573 points perhaps on the news that Representative Seth Moulton, whoever that may be, has dropped out of the 2020 Presidential Race!” Mr. Trump tweeted. (The Dow Jones industrial average finished the day 623 points down.)

Mr. Trump’s tweets caught most of his advisers and staff by surprise. His advisers have grown concerned that he is creeping perilously close to turning what they had hoped would be his signature issue into a liability. His moves risk scaring away voters, including some of his own backers.

His aides believe Mr. Trump is being urged on by Robert Lighthizer and Peter Navarro, his trade advisers, who generally share the president’s hostile view of China and who advocated a confrontational path with tariffs. Some said they have filled a void left by Mick Mulvaney, the acting chief of staff, who has not weighed in forcefully.