It's difficult to tell what would or what would not have happened. What is certain was that the Taliban were one of many Middle-eastern factions former President Trump was in peace talks with. Trump wanted to get our people out of the region and the withdrawal was agreed to happen even earlier. It's good that Biden followed through on Trump's decision, though reneging on the agreement that was struck likely exacerbated this whole thing.
With the way Trump handled peace talks and foreign relations in general, it's difficult to argue that things would not have been different. Trump styled himself as "America's bully" and that seemed to throw many world leaders off their base... it's difficult to know how to handle someone who is so bullish and seemingly erratic, after all. I don't believe our withdrawal under Trump would have ever been flawless... too much animosity, distrust and hate of America baked into the Afghani culture for that. However, I think you're correct that things would have been different in a preferable way.
Fortunately/unfortunately, we'll never know because he is no longer President. What we know for sure is that Biden broke the original agreement to buy himself extra time... and still couldn't get it right. In so doing, he's put thousands of Americans and countless local nationals at risk of tortured/executed, lost military-grade equipment/armaments costing trillions and has weakened our position on the world stage. Which, I don't know if you're paying attention, is a REALLY BAD position to be in right now.
It's an interesting thought experiment though.