And yet the Taliban was able to take over before the US fully withdrew our "professional military" from Afghanistan.
America left before the job was finished. That was courtesy of Donald Trump, who wanted out. There are a number of problems with the Western world's militaries. They are not equipped to fight armed groups like the Taliban. It is the same reason that America lost in Vietnam. America won all the battles, but lost the war. That's because the Vietnamese did not fight like a regular army. America's rules of engagement were ridiculous.
The British showed how an insurgency could be defeated in Malaya. Americans learned little from British/Australian strategy and tactics. If the Western world had its way, Israel would be hamstrung by impossible rules of engagement that would allow Hamas to be as effective against Israel as the Taliban were in Afghanistan.
Just one example. A small force of British SAS defeated the Taliban in a village. The Taliban withdrew after a long battle. Instead of holding the village and protecting the inhabitants, the SAS were relocated. The Taliban came back with their combination of threats and promises. Anyone suspected of helping the SAS was executed. The rest were bribed and some men joined the Taliban. That is no way to win a war and anyone with half a brain could see it. There was incredible corruption. America was paying wages to Afghan soldiers who did not exist. So America pulls out, vainly imagining that Afghan's official military would at least hold the Taliban at bay.
History teaches us that we learn nothing from history. I don't remember who said that, but it is the truth.