As for the collapse of the regime of the former Afghan government, it is most eloquently characterized by how Ghani run away from Afghanistan:
a part of his cash money was loaded onto four cars,
they tried to shove another part of the cash into a helicopter, but due to lack of space not everything fit, and a part of the money was abandoned on the take-off airway field.
In general, the situation is not to say that it is unexpected. Recruitment for the indigenous administration ruled by the principle “the nastier – the better” is a chronic problem in the American model of colonies management. The same way they selected the Iraqi administration from outright scum while squeezing out the authoritative and intelligent ones. As a result, they’ve got a massive beating of the Sunnis and, as a reaction to terror – the Islamic State. Eventually, Iran generally seized control of the Iraqi authorities.
To sum up, the occupation is a business not for stupid, that Americans have demonstrated over and over again. And the point is not in the local personnel and those who recruit them.