By late Saturday afternoon, Mr. Trump had made his decision, but he waited to announce the reversal until that night in two tweets that were separated by a break he took to watch the opening of Jeanine Pirro’s Fox News program.

“I thought I was doing something very good for our country by using Trump National Doral, in Miami, for hosting the G-7 leaders,” Mr. Trump wrote on Twitter before again promoting the resort’s amenities. “But, as usual, the Hostile Media & their Democrat Partners went CRAZY!”

Mr. Trump added, “Therefore, based on both Media & Democrat Crazed and Irrational Hostility, we will no longer consider Trump National Doral, Miami, as the Host Site for the G-7 in 2020.”

Mr. Trump suggested as a possibility Camp David, the rustic, official presidential retreat that Mr. Mulvaney had denigrated as an option when he announced the choice of Doral. But Mr. Mulvaney said the president was candid in his disappointment.

The president’s reaction “out in the tweet was real,” Mr. Mulvaney said on “Fox News Sunday.” “The president isn’t one for holding back his feelings and his emotions about something. He was honestly surprised at the level of pushback.”

Mr. Trump’s unhappiness may also extend to Mr. Mulvaney, who at his Thursday news conference — whose intended subject was the summit hotel choice — essentially acknowledged that the president had a quid pro quo in mind in discussions with Ukrainian officials.

But advisers to Mr. Trump were stunned. The president has frequently expressed unhappiness with Mr. Mulvaney to others, and he recently reached out to Nick Ayers, a former aide to Vice President Mike Pence, to see if he had interest in returning, according to two people close to the president. Mr. Ayers is unlikely to return to Washington, but the conversation speaks to Mr. Trump’s mindset at a time when he is being urged by some advisers to make a change, and several people close to the president said Mr. Mulvaney did not help himself in the past week.