Philosophically this can get deep.
Che Guevera in his book Guerrilla Warfare wrote that you can only succeed in revolution if its popular. The term "popular revolution" exists for a reason. Che wrote that the first thing you need to do in revolution is to get the backing of the people quick, if not, your revolution will fail.
This can be applied to the US failure in afganistan. The US isnt popular in Afganistan, and neither is the regime the US backed for 20 years.
And this proves no matter how powerful you are as a military, you wont succeed in regime change unless you have the support of the people