But the agreement Pompeo worked out with the Taliban last year set a May 11 date for all U.S. troops to be out. Absent the Taliban violating it before then I don't see how Trump could have left troops in country after May 11.
It had many conditions which you are not mentioning.
FYI - the UN was monitoring adherence to Doha Agreement. The team doing the monitoring wrote a letter/report in April 28, 2021 reporting that the Taliban had violated the agreement because they allowed members of alQaida to stay in Afghanistan. And you know from reading the agreement, that was forbidden.
SO, Trump wouldn’t have been breaking the agreement, since the Taliban already did.
I think he was betting/assuming when they made the Doha agreement that the Taliban wouldn’t stick to it, and he could do what he wanted at that point. And he was right - they didn’t adhere to the agreement.