This isn't an entirely fair argument against Trump.
March 2007 was pre-surge, we were losing a lot of troops, and victory of any kind in Iraq looked unattainable. So at that point, withdrawing was not an unreasonable option, even among many in the military.
In contrast, Obama (who opposed the surge) was faced with an entirely different question. At that point, the surge was successful (despite the predictions of many in the military itself), casualties had dropped precipitously, and Iraq looked well on its way to being able to hang on. We were just needed there to preserve that very hard-won victory. And when Obama made the decision to withdraw completely, almost nobody supported that idea, particularly within the military. It appeared to be, and was, an horrible mistake.
To put it differently, Trump advocated snatching defeat from the jaws of defeat. Obama snatched defeat from the jaws of victory.