The closest I can come to a credible rationale is that the US is trying to stabilize Afghanistan so it is not fertile ground for anti-US and US ally attacks. But it is very hard to believe that imported democracy will survive after the US withdraws. The US looks like Sisyphus here, rolling democracy up the hill of Afghanistan.
This has happened far too many times to chalk up to leaders making bad decisions. This IMO is an inherent deficiency of the US political structure. We need to disentangle ourselves from the strings that keep pulling the US into these misadventures. Bin laden may not have intentionally pulled on these strings, but my guess is that he knew full well what he was doing.