Let’s be honest, each President since 2005ish (so yes, including Bush) didn’t want Afghanistan to fail under their watch because Afghanistan for the longest time was seen as the legit/supported war. As public support for more activity decreased, Trump was wanting to wind it down substantially, as was Biden. In the end, Biden made the call to end it, most likely when his advisors told him that the government/Afghan military could at least hold things together for a while…which obviously didn’t happen. And anyone who did any sort of close advising in Iraq or Afghanistan knew that this wasn’t going to work out, especially in Afghanistan.
BL: As M2 states above, we absolutely suck at nation building. It might sound good on paper, but it’s not worth it. So no, staying in Afghanistan after the first few years was most definitely not worth it. I’m all for going in and breaking things if we think it will net positive the interests for American citizens, but then that’s where things need to stop. But hey, the defense contractors made some serious money.