Some of what Trump did is questionable. He did however give generals free reign on how to operate there and he did maintain a force that ensured stability.
At some point the soldiers were going to have to leave, though I think the U.S was basically just trying to maintain them there for logistical and intelligence purposes.
I never considered this broader agenda to be honest (as I've said, I'm not the brightest).
It is possible that U.S politicians weren't savvy in their approach to the issue and instead they tip toed around it for 20 years, knowing that China and others were not happy with their presence there. Their opinion didn't matter in 2001 as China was so weak, thanks to the West, China is now very strong and their opinion suddenly matters.
As I suggested, after considering the options, maybe an East/West setup comparable to East/West Berlin would have made more sense. It certainly would have been a defensible position considering how drastically different citizens lives are under the Taliban.