The big mistake the Biden admin made was believing the constant lies from the DoD and NSC about the readiness of the Afghan army and whether Afghans would be willing to mount any kind of resistance to the Taliban in order to preserve the corrupt national government. It was clear to anyone who had any objectivity that the Afghan army was a complete joke and the central government was seen as corrupt and a pawn of the US. Afghans hate the central government and fear the Taliban.
The US was never in Afghanistan to protect women's rights or to establish a democracy. It was always just a geopolitical play to have a massive military presence a short ride in a F16 to Iran and to justify a massive military budget that had nothing to do with any actual military threat to the US or its allies. It really was not much more than make work for the US military.
How the Taliban treats women is about the same as women are treating in many parts of Pakistan, Saudi Arabia, Yemen and so on. The US military could have squashed the Taliban like a bug if they wanted to, but that would have required a full on occupation of the entire country and an extended period of a US administered government, which would have been seen in the region as the cultural conquest of a Muslim nation. The US never had the political will to do that because it would have caused unrest in Pakistan and Saudi Arabia that could have toppled friendly regimes.
In the end, I actually give Biden credit for getting out of Afghanistan. However, it does not come from a principled stance against US imperialism. It comes from the typical neoliberal strategy of coopting the other party's position by taking a page from their book. The current right wing/Trumpist Republican party base is very anti interventionist. Biden knows that any critique of the withdrawal by Trump or a Trump-esque candidate in 2024 will fall flat on the right wing base. He also knows that continuing the occupation would have cost many more lives as the Taliban had been gaining strength and the central government had all but lost any credibility in the nation. So, in 2024, Biden would either have to defend increasing violence and casualties in Afghanistan or a pull out and the restoration of the Taliban. Outside of the never Trumper Nat Sec Gulf War idiots like Kristol, Rubin, Boot, etc., most of the Dem base wanted out of Afghanistan and a much stronger focus on domestic issues. So, this was actually an easy call for Biden.