If you really want re-hear about the media narrative of USA then, it was, Taliban are the helpers of Alqaida, and hence a regime change in Afghanistan is necessary. But it was not the real motive.
Real motive was the ultimate destruction of Syria. USA got attacked, blame came of Alqaida, Taliban demanded proof, USA refused, attacked Afghanistan, fought against Talibs, Talibs busy for next 17 years, hence were not able to participate in Syrian war, Israel started preparations somewhere near 2004, preparation completed somewhere near 2011-12, operations in Syria launched somewhere near that time, massive evacuation from Syria to Europe, Israeli operations truely ended in 2018, and hence USA is no more required in Afghanistan.
You are giving both answers, chose the one you like.