On the face of it Bosnia, Iraq and Afghanistan are completely different. In Bosnia the international community interfered in a conflict while in the other two contries it drove out a repressive regime and restored democracy. But in every country the internationals end up supporting one group, faction or party and they find their hands bound by loyalty to this group. In Bosnia the internationals can't get beyond supporting the Muslims while they can't find a way to handle the Serbs. In Iraq the Kurds are still the favorites while the Sunnites are problematic. In Afghanistan the internationals have chosen for the Pashtu and Karzai. Despite having been the allies of the internationals the Tadzhiks are considered more problematic.
It reminds me of the colonial era where the colonizers often had their favorites too. Then the bad consequences only became visible after independence. Now we see them almost immediately.
Is there a solution? Maybe. It is very seducive to choose an ally during or immediately after the easy part: the conquest. It is also seducive to give this ally a lot of power by imposing a centralized system of government. And then you are stuck. But a decentralized approach might help.
For those who like to be informed on Afghanistan: the report by McChrystal is available on internet. The available report has some sections deleted to protect sensitive information.