eh, to be fair, a LOT of people THOUGHT we could "win" in Afghanistan. W. Bush, Obama, Trump, and Biden all played a role over the years. I think all of these people bought into the idea of "American Exceptionalism" and thought we could somehow not end up the same way as pretty much everybody else did.
personally, I didn't see us having any better luck than the Soviet Union... and they were a LOT closer and had more to gain by their involvement. the Soviets ended up pulling out after they realized that they couldn't "win" without catastrophic political consequences.
the Anglo-Afghan War didn't end all that well for Great Britain either. both of these countries had a number of strategic and territorial advantages that the United States simply never had when dealing with Afghanistan. so, I'm puzzled that we held on to that notion of staying in Afghanistan for as long as we did.