“The president’s governing philosophy appears to be ‘if it feels good, do it,’ but when he attacks his Republican allies he’s not only helping Senate Democrats, but he’s hurting his ability to get his agenda through Congress,” Mr. Walsh said.

At her briefing on Friday, Ms. Sanders was asked how the president would advance legislation with a slim Republican majority when he attacked his own party. She shifted the blame to Congress, saying: “I think it’s clear that the end game is for Congress to do its job and actually pass legislation. I think the American people are very frustrated with Congress’s lack of action.”

Some of Mr. Trump’s closest allies say that he believes he cannot go wrong attacking his own party, having won a presidential race doing just that, or separating himself from an unpopular Congress. And some White House advisers say the president needs to remind people that he won by campaigning against Washington and politics as usual.

But those advisers also say that reading too much into his Gatling-gun-style Twitter sprees is a mistake, and that there are few illusions inside the West Wing that Mr. Trump would be able to shift the blame if his plan for tax cuts meets the same fate as his push for a health care repeal.

Mr. Trump’s brewing feud with Mr. Corker is even more remarkable because Mr. Corker is the rare Republican senator who has developed something of a personal relationship with the president. Mr. Corker was seen as a possible running mate for Mr. Trump, and then a contender to be secretary of state, and the two speak regularly.

In April, they had dinner, and in June, Mr. Corker was spotted outside the White House along with Peyton Manning, the former N.F.L. quarterback, after Mr. Trump’s motorcade returned from a trip to Trump National Golf Club in Virginia.