HOUSTON — While competing for the Republican presidential nomination in 2016, Donald J. Trump posed a biting question to voters: “Why would the people of Texas support Ted Cruz when he has accomplished absolutely nothing for them?”

More than two years later, President Trump visited Texas to answer his own question: because Mr. Cruz now supports Mr. Trump.

“It got nasty,” Mr. Trump acknowledged about their contest as he addressed an arena full of supporters on Monday on behalf of Mr. Cruz’s campaign for re-election to the Senate. “And then it ended. And I’ll tell you what — nobody has helped me more with your tax cuts, with your regulation, with all the things that we’re doing, including the military and the vets, than Senator Ted Cruz.”

If ever there were a moment during this midterm election race that reinforced just how much Mr. Trump has claimed control of the Republican Party, it came during the rally at Houston’s Toyota Center. While many elected Republicans remain privately dismayed by the president for various reasons, they have put aside their qualms to embrace him during this campaign season, as demonstrated by Mr. Cruz, one of Mr. Trump’s last and most virulent opponents during his journey to the White House.