“I assumed I was going to win, and win handily. And that all gets upended,” Mr. Richter said in an interview at his home in Avalon. “Donald Trump did what was in the best interest of Donald Trump.”

The endorsement was hardly a day old before Mr. Richter’s institutional support began to crumble. His top advisers phoned in their apologies and said they were headed to work for Mr. Van Drew. The National Republican Congressional Committee scrubbed Mr. Richter, 52, from its 2020 Young Guns program, which is meant to highlight rising stars in the party.

Mr. Richter has remained in the race, but he now finds himself campaigning ostensibly in support of both the man and the institution that rejected him. As even longtime Republican lawmakers can attest, the merest dissent against this president can wreak havoc on one’s career, often in the form of 280 characters.