The president demands complete fealty, and as the impeachment hearings showed, he has largely attained it. To cross him is to risk a future in G.O.P. politics.

Credit...Pete Marovich for The New York Times

BIRMINGHAM, Mich. — By the summer of 2017, Dave Trott, a two-term Republican congressman, was worried enough about President Trump’s erratic behavior and his flailing attempts to repeal the Affordable Care Act that he criticized the president in a closed-door meeting with fellow G.O.P. lawmakers.

The response was instantaneous — but had nothing to do with the substance of Mr. Trott’s concerns. “Dave, you need to know somebody has already told the White House what you said,” he recalled a colleague telling him. “Be ready for a barrage of tweets.”

Mr. Trott got the message: To defy Mr. Trump is to invite the president’s wrath, ostracism within the party and a premature end to a career in Republican politics. Mr. Trott decided not to seek re-election in his suburban Detroit district, concluding that running as anti-Trump Republican was untenable, and joining a wave of Republican departures from Congress that has left those who remain more devoted to the president than ever.

“If I was still there and speaking out against the president, what would happen to me?” Mr. Trott said before answering his own question: Mr. Trump would have lashed out and pressured House G.O.P. leaders to punish him.

Just under four years after he began his takeover of a party to which he had little connection, Mr. Trump enters 2020 burdened with the ignominy of being the first sitting president to seek re-election after being impeached.

But he does so wearing a political coat of armor built on total loyalty from G.O.P. activists and their representatives in Congress. If he does not enjoy the broad admiration Republicans afforded Ronald Reagan, he is more feared by his party’s lawmakers than any occupant of the Oval Office since at least Lyndon Johnson.

His iron grip was never firmer than over the last two months, during the House inquiry that concluded Wednesday with Mr. Trump’s impeachment on charges of abuse of power and obstructing Congress. No House Republican supported either article, or even authorized the investigation in September, and in hearing after hearing into the president’s dealings with Ukraine, they defended him as a victim of partisan fervor. One Republican even said that Jesus had received fairer treatment before his crucifixion than Mr. Trump did during his impeachment.

Perhaps more revealing, some G.O.P. lawmakers who initially said Mr. Trump’s phone call with the president of Ukraine was inappropriate later dropped their criticism. People close to Mr. Trump attributed the shift both to his public defense of the call as “perfect’’ and to private discussions he and his allies had with concerned lawmakers.

This fealty hardly guarantees Mr. Trump re-election: He has never garnered a 50 percent approval rating as president and over half of voters tell pollsters they will oppose him no matter who the Democrats nominate.

But the shoulder-to-shoulder unity stands in contrast to Democrats at the moment, with their contentious moderate-versus-liberal primary that was on full display in Thursday night’s debate. And it is all the more striking given Mr. Trump’s deviations from longstanding party orthodoxy on issues like foreign policy and tariffs.

“He has a complete connection with the average Republican voter and that’s given him political power here,” said Representative Patrick McHenry, Republican of North Carolina, adding: “Trump has touched the nerve of my conservative base like no person in my lifetime.”

Interviews with current and former Republican lawmakers as well as party strategists, many of whom requested anonymity so as not to publicly cross the president, suggest that many elected officials are effectively faced with two choices. They can vote with their feet by retiring — and a remarkable 40 percent of Republican members of Congress have done so or have been defeated at the ballot box since Mr. Trump took office.

Or they can mute their criticism of him. All the incentives that shape political behavior — with voters, donors and the news media — compel Republicans to bow to Mr. Trump if they want to survive.

Sitting in a garland-bedecked hotel restaurant in his former district, Mr. Trott said that he did not want to seek re-election “as a Trumper” — and that he knew he had little future in the party as an opponent of the president.

There is no market, he said, for independence. Divergence from Trumpism will never be good enough for Democrats; Mr. Trump will target you among Republicans, Mr. Trott added, and the vanishing voters from the political middle will never have a chance to reward you because you would not make it through a primary. That will be ensured in part by the megaphone the president wields with the conservative news media.

“Trump is emotionally, intellectually and psychologically unfit for office, and I’m sure a lot of Republicans feel the same way,” Mr. Trott said. “But if they say that, the social media barrage will be overwhelming.” He added that he would be open to the presidential candidacy of former Mayor Michael R. Bloomberg of New York.

On the other hand, Mr. Trump dangles rewards to those who show loyalty — a favorable tweet, or a presidential visit to their state — and his heavy hand has assured victory for a number of Republican candidates in their primaries. That includes Gov. Ron DeSantis of Florida, who did as many Fox News appearances as possible to draw the president’s attention.

“The greatest fear any member of Congress has these days is losing a primary,” said former Representative Carlos Curbelo, Republican of Florida, who lost his general election last year in a heavily Hispanic Miami-area district. “That’s the foremost motivator.”

The larger challenge with Mr. Trump is that all politics is personal with him, and he carefully tracks who on television is praising him or denouncing his latest rhetorical excess. “He is the White House political director,” Scott Reed, a longtime Republican consultant, said.

More conventional presidents may be more understanding of lawmakers who are pulled in a different direction by the political demands of their districts — but Mr. Trump has shown little tolerance for such dissent. Mr. Curbelo, for instance, occasionally spoke out against Mr. Trump, particularly over immigration policy, and the president took notice.

Riding with Mr. Trump in his limousine on Key West last year, Mr. Curbelo recalled in an interview that the president had noted that people were lining the streets to show their support for him, and asked Mr. Curbelo if they were in his district.

He said they were, prompting the president to turn to others in the car and say: “Maybe Carlos will stop saying such nasty things about me,” Mr. Curbelo recalled.

He said they all laughed but the “passive aggressive” comment, as he put it, was not lost on him.

Increasingly, though, Mr. Trump does not even have to make implied threats within his party — Republicans can ascertain the benefit of sticking with him.

Representative Elise Stefanik hails from an upstate New York district that the president carried by 14 points yet she had not previously hesitated to go her own way.

“I have one of the most independent records in the House,” Ms. Stefanik said. “And I have critiqued the president, have voted differently than the president.”

Yet after she vehemently criticized the impeachment hearings and found herself under attack by George Conway, the anti-Trump husband of the White House adviser Kellyanne Conway, she welcomed the embrace of the president, his family and news media allies such as the Fox News host Sean Hannity — and the campaign donations that poured in.

Ms. Stefanik said she opposed impeachment because Democrats failed to make a convincing case. But she said that she would not have even voted to censure the president, and that she was chiefly driven by wanting to “stand up for my district.”

And, Ms. Stefanik noted, since her “no” vote she had received “the most positive calls since I was sworn into office.”

The incentive to show fealty to Mr. Trump has become evident to the Club for Growth, a fiscal conservative group that was made famous for its willingness to tangle with Republican leaders and was hostile to Mr. Trump in 2016.

The group’s president, David McIntosh, said conservative voters had lost interest in punishing ideological heresies and were motivated by one overarching factor unrelated to policy.

“Poll after poll showed us that Republican primary voters wanted their nominees to support President Trump,” he said, “so in order to make sure they were viable and would get re-elected, they ended up being supporters of his.”

Mr. McIntosh and Republican lawmakers said Mr. Trump’s largely conservative record had made it easier to remain loyal, noting his tax cuts, deregulation and judicial appointments.

Lawmakers not seeking re-election are often the most candid about the slavish devotion Mr. Trump engenders with voters — and the pressure it puts on them.

“Public officials need to be held accountable, and I don’t think any governmental system works well with blind loyalty without reason,” said Representative Francis Rooney of Florida, who announced his intention to retire earlier this year after criticizing Mr. Trump for his conduct with Ukraine and suffering an immediate backlash.

Mr. Rooney ultimately voted against impeachment, but told colleagues he felt uneasy about it. Recalling an appearance on a Florida television station afterward, Mr. Rooney said: “They interviewed me after the vote and then they interviewed one of these Cape Coral Republican ladies and she said, ‘Well, it’s about time they came around to realize it’s a big media hoax.’ How do you argue with that? How do you reason with that?”

Many of the Republicans who may have considered impeaching Mr. Trump are gone. They were part of a 40-seat loss the party had in the House last year, which deprived the caucus of many of its most independent figures and left it more supportive of the president than ever.

So why was there no introspection within the party after the midterms about the damage Mr. Trump did to Republican candidates, particularly in the suburbs?

“If you go to any Republican event, you’re going to find more people at that event than ever before,” Mr. Trott said “and every single one of them to a person will be all in for President Trump. They’ll all have ‘Make America Great Again’ hats on and they’ll be saying what a tremendous president he is.”

Mr. Trott recounted one of his most vivid memories of his time serving with Mr. Trump. It was the day in 2017 when House Republicans voted to repeal the A.C.A. and celebrated afterward at the White House.

Mr. Trott was one of the first lawmakers to enter the Oval Office after the Rose Garden celebration and he stood behind the president’s desk when Mr. Trump pulled out a sheet of paper.

“He already had a list of 20 people who had voted against him two hours earlier,” he recalled.

Nicholas Fandos contributed reporting from Washington.