“There’s no illusion about the storm that’s coming,” said Representative Tom Cole, Republican of Oklahoma, invoking last month’s governor’s races and last week’s Senate special election. “If you had any doubts, they were wiped away after New Jersey, Virginia and Alabama.”

From Texas to Illinois, Kansas to Kentucky, there are Republican-held seats filled with college-educated, affluent voters who appear to be abandoning their usually conservative leanings and newly invigorated Democrats, some of them nonwhite, who are eager to use the midterms to take out their anger on Mr. Trump.

“If you look at the patterns of where gains are being made and who is creating the foundation for those gains, it’s the same: An energized Democratic base is linking arms with disaffected suburban voters,” said Mayor Rahm Emanuel of Chicago, who as a member of Congress in 2006 helped Democrats win back the House. “The president’s conduct has basically given voters this permission slip to go against the Republicans.”