I get it.
I guess the calculation to be made is this. In the future, is it going to be better or worse for you to be in Afghanistan?
Last time, it turned out not being in Afghanistan was worse than being in it. 9/11 etc.
But I understand why the US has given up. It did its best. It's just a lousy country from the perspective of military engagement.
Good luck to whoever has it next. No one ever enjoys the experience.