What did the US get?
https://www.usip.org/publications/2022/11/afghanistan-was-lo...
It improved the quality of life and security for the people their immeasurably positively. If the withdrawal had not happened, and better leadership was displayed, the would have been completely wiped out.
What they were trying to get, was another ally in the region. They could have to, if it weren't for poor leadership.
Those things have not been achieved. If those were the aims, the US lost and the Teliban won.
That's one way to look at it sure. From a purely force against force perspective though, they didn't come anywhere close to losing.
Yes, I agree. The US saw this as a military problem, but that was only part of it. Winning a particular ground battle, capturing a town etc was only part of what was needed.
No one fled.