The problem with “nation building” a place like Afghanistan is that it’s a collection of wildly different places and peoples. Three-quarters of the people still live in the countryside. They comprise about a dozen main tribes and countless smaller tribes. Many different languages are spoken. Two are official languages but the dominant one is not spoken by a quarter of the population.
It’s true that nearly all Afghans are Muslim. But a millennium of strife in the Middle East has driven home the point that there are Muslims and there are Muslims, and they like to war with one another. Their wars are typically over stupid things.
The Muslims are not alone in their religious wars. Look at the centuries of Christian war in Northern Ireland between Catholics and Protestants. Those are tribal wars founded on hate.
These tribes and their wars are not limited to religious strife, and also exist in societies we like to consider civilized. The clans of Scotland and rural England feuded for centuries and brought their feuding ways with them to American Appalachia. Remember the Hatfields and McCoys?