Purely speculating… I wonder if there were any talks about this. I don’t think the US would leave without ensuring that no terrorism would come out of it, same with the Taliban now keeping civilians and those who surrender unharmed.
Perhaps they made a deal where the Taliban can do what they want as long as they don’t bother others.