Flying home Monday after the summit with Russian President Vladimir Putin, President Donald Trump and his senior aides recognized that he had made a mistake that risked lasting damage and needed to be fixed quickly, people familiar with the matter said.

Playing on a loop on television was footage of the president standing next to Mr. Putin, casting doubt on the U.S. intelligence community’s finding that Russia interfered in the 2016 election and aligning himself with Moscow’s denial of any meddling.

Mr....