Since the end of the Cold War, one of the unfortunate patterns in American foreign policy has been the tendency of new presidents to denounce their predecessors’ approach to the world—only to repeat their mistakes.

As the Trump administration debated the way ahead in Afghanistan in recent months, it risked falling into this trap. For all their differences Donald Trump and Barack Obama both entered office ambivalent about the flagging war effort in South Asia. Each was sensitive to the threat of terrorism from the region, but...