“There has always been this dangerous part of him that will go too far and do something that backfires,” said Michael D’Antonio, the author of “The Truth About Trump,” a new biography of the real estate mogul.

“His worst impulses,” he added, “are self-defeating.”

Over the past few days, those instincts have been on vivid display. In quick succession, Mr. Trump has repeated his critique that Ms. Machado gained a “massive amount of weight” after she won the Miss Universe crown in 1996; suggested that former President Bill Clinton’s infidelities are fair game for campaign attacks; and urged his followers to “check out” a sex tape that may not exist. (Ms. Machado appeared in a risqué scene on a reality television show, but fact-checkers have discovered no sex tape.)

The eruptions could further damage Mr. Trump’s reputation with women and Latino voters at a time when he can scarcely afford to alienate either group, five and a half weeks before Election Day.

Yet for close students of Mr. Trump’s career and campaign, it all has a familiar ring. Over the years, he has issued a stream of needlessly cruel and seemingly off-the-cuff insults — both on and off social media — that have inflamed the public. He declared on Twitter that Kim Novak, a reclusive 81-year-old actress at the time, “should sue her plastic surgeon,” sending her into hiding. He derided the appearance of a rival, Carly Fiorina, angering female voters by asking: “Can you imagine that, the face of our next president?” And he criticized the mother of a slain American soldier, musing that as a Muslim woman, she was not “allowed” to speak.