“He can’t help himself,” said Timothy L. O’Brien, who experienced it firsthand in writing his own book on Mr. Trump during his business days. “He’s profoundly addicted to public attention and the media is his vehicle for making sure he gets it. His view is he can live with negative coverage and positive coverage. He can’t live with no coverage. So he constantly puts himself in the cross hairs.”

White House aides and allies are in the meantime busily setting up circular firing squads to affix blame. Tucker Carlson, the Fox News host, has been faulting Senator Lindsey Graham, Republican of South Carolina, for facilitating the interviews.

But advisers know that no amount of counsel would have stopped Mr. Trump from cooperating with an author like Mr. Woodward once he decided he wanted to. As Jared Kushner, the president’s son-in-law and senior adviser, put it in an unrelated interview last month, “He always needs to touch the flame.”

Mr. Trump even seemed to understand the risk from the beginning and then proceeded anyway.