Sure, as president, Biden could have decided to reneg the treaty Donald Trump signed last year with the Taliban to pull all American troops out of Afghanistan by May 31st this year (pretty sure that was the original date agreed upon by the Trump administration and the Taliban.. or was it April... would have to look it up... it got pushed back, obviously, because it would have been even more rushed). Yes, as president, Biden could have attempted to renegotiate. But as the leader of America, the same America that Trump represented by signing the treaty last year -- and a treaty is an oath with a clearly stated intention to follow through, make no mistake -- had Biden done an about-face and failed to abide by the terms agreed upon, then the Taliban would have been within their rights to 1) call America a liar & a bad actor, and 2) dump the promises they made in that treaty, too, and then the situation would have been even worse.
It was a bad choice that had to be made, no matter which way it went.
I would point out that Bush and Cheney were the ones who got us into Afghanistan in the first place (and all based on a lie -- the 911 terrorists were from Saudi Arabia, not Afghanistan, and Bin Laden's source of power and money remained in Saudi Arabia even long after he set up shop for a while in the mountains). We should never have been there, and we certainly should never have tried to "nation-build" there for 20 years. It was LONG past time to leave.
Could the leaving process have been smoother? Absolutely. Both administrations -- Trump's and Biden's -- should have heeded the warnings of the CIA and other intelligence agencies. Trump had a long track record of completely ignoring the CIA, but Biden should have listened, too; both presidents were warned that the moment America pulled its troops out, Afghanistan would begin to fall to the Taliban (and come on, we all knew that would happen; we've known it for more than a decade). The CIA's projections of how long it would take ranged from 18 months on the optimistic side, to a matter of days on the pessimistic. It took a few weeks. It was fast, and shocked some people, but didn't shock others.
It is what it is. Had Trump finished enacting the treaty he signed with the Taliban, and pulled America out before his presidency ended, I daresay it would have been even more rushed, and probably even more catastrophic. He had ordered his generals to do it, but they pointed out the logistics of it all, and by then, Donald had his hands full with trying to stage a coup.