Trump would have made a bigger mess out of it by staying isolated and letting Chin-Pak-Rus have a free run due to his isolationist stance. Strategically, he just has no vision for the long term.
Just that these end-moment optics would not have been this bad- evacuation and troop pullout would have happened better.
Trump was and is smarter than you think. From POV of India, it may sound crucial not to let Rus-Chin-Pak run amock in Afghanistan, but from POV of USA, it is absolutely fine so long those parties don't get the complete control over the region. Trump may sound dumb, but not a single step taken by him in actual was a misstep for the interest of the future of USA.
He challenged the thoroughly anti-USA trade deals and got the deals that brings back jobs to USA. He secured much of the border in the south and had he not been thwarted, he could have deported all the illegal migrants with criminal background which would have made US streets safer. He would never let a stupid and dangerous curriculum like critical race theory be funded by the federal govt. He was wiser that he actually helped Russkies and Syria in finishing off ISIS in Syria by refusing to increase US involvement in the area. He made real effort of bringing North Korea into the mainstream and I guess the failure must have been because of the North Korean warhawks and chinese influence.
There are many instances which shows that under the boorish facade, there lies a smart brain - an egoist businessman's brain, but smart nonetheless.
I detest his attitude, but I respect his stands. He is pro-USA through and through. So, even if his steps might not have been good for India (as if Biden is going to be any better), from POV of USA, he was much better than any president that came before him in last 2 decades.