Eight years later, as Mr. Obama and the veterans of his administration gear up to help Mrs. Clinton get elected in November, there is no better motivation for them than the prospect of a President Trump ordering a similar reversal.

Driven by those fears, the president plans to campaign aggressively for Mrs. Clinton this fall. Aides have largely cleared his calendar in October, and barring new crises, the White House expects Mr. Obama to be on the campaign trail almost daily leading up to Election Day.

Based on what he has said, Mr. Trump would probably use the power of the Oval Office to quickly overturn Mr. Obama’s immigration actions, try to unravel the Affordable Care Act, order the Environmental Protection Agency to lift regulations on coal plants established under Mr. Obama, reimpose abortion restrictions at home and abroad, shift the focus of American foreign policy, start building a wall along the border with Mexico and bar entry to the United States from countries with a history of terrorism.

Some of Mr. Obama’s closest advisers describe that as their worst nightmare.

“I’m sure he thinks about that first 100 days the way the rest of us do,” Dan Pfeiffer, the president’s former senior adviser, said of Mr. Obama. “You wake up every day, and another thing that you and your team worked so hard to do is undone. That would be more painful than the president or any of us can imagine.”