Indeed. We should have been out of there long ago once it became clear that we did not understand the conditions for victory anymore / when we realized that we did not want to allocate the resources required to win. Staying this long was pure sunk cost fallacy combined with weak leadership. Kudos to Biden for having the balls to rip the bandaid off, as painful as it is.
Of course there was a "winning strategy." China is about to embark on it. There must have been clear signs that the Taliban was capable of doing what they just did. Even if the goal is to exit Afghanistan (which we should have done a long time ago) you still need to build a bridge out and not simply let the cardboard government collapse on itself spontaneously. We should have been making concessions to the Taliban, acknowledging it is a legitimate political force in Afghanistan. At the very least we should have negotiated a permanent military base in Afghanistan while accepting Taliban control of the rest of the nation. We spent too long trying to do too much and ended up getting nothing and looking stupid.
A single isolated military base would be untenable without reasonably secure land supply routes for fuel and other bulk supplies. The US military lacks the airlift capacity to fly in everything needed on a permanent basis.
Look at the southern US border. Another disaster.
Barack Obama himself said it: "Never underestimate Joe's ability to f** things up".