you’re confused.
the Taliban was the legitimate government of A-stan. We overthrew them for their support of AQ and installed a different regime. That regime is now in talks with us involved to reconcile. In the agreements we have made a US presence will remain in A-stan to counter and resurgence of AQ and the Taliban has agreed to it. If they had given up AQ 18 years ago we would never have overthrown them to begin with.