A war doesn't end when a government is deposed, it ends when resistance ceases (which is generally because morale breaks). Up until, and including, the final day of US withdrawal in Afghanistan the Taliban were fiercely resisting. US troops rarely left their little green zones because they would have been killed, same as in Iraq. The media stopped meaningful coverage of the war relatively quickly, which I think led people to believe that meaningful resistance wrapped up relatively quickly, but that's not the case at all. The Taliban ended up killing at least 75,000 soldiers/security forces and wounding what was likely some large multiple of that.
All of the things you're discussing are not things that the US simply didn't bother to try to solve, but we were ultimately powerless to do so. Americans would never tolerate US soldiers dying by the tens to hundreds of thousands as would have happened if we actually tried to enforce order on foot. So we were left with proxy soldiers, contractors, and a money printing machine. But that simply wasn't enough to defeat the Taliban, let alone carry out the grand changes you mention.
> All of the things you're discussing are not things that the US simply didn't bother to try to solve, but we were ultimately powerless to do so.
I disagree with this assessment.
Had the Western forces provided actual, proven economic opportunities for the people, the supply of "resistance" fighters would have dwindled. People don't become terrorists or insurgents just because, they follow that path because they do not see a gainful alternative to this life. (Side note, we're seeing this also in Palestine where Hamas and Fatah both draw a steady supply of recruits from the desperate)
Afghanistan has untold billions of dollars worth of all kinds of natural resources [1]. But no attempt was made, not even on paper, to exploit these natural resources. IMHO, even a single pilot project would have been a good start - a mine that pays a decent amount of money to the workers and the profits going to the national government as well as local authorities. Basically, show to the wide population that something good came around from all the suffering in the end, provide an alternative from the Taliban propaganda that at least promised salvation in the afterlife for killing infidels.
But no, we ignored this opportunity, which meant that other than "women can go to schools" we did not have any talking points available to counter the Taliban propaganda of "they're killing us with impunity and the puppet government is looting". That is how we truly lost, and what China and a bunch of oil sheiks will now enjoy.
[1] https://globalinitiative.net/analysis/why-is-afghanistan-par...