Zia-ul-Haq, the Pakistani President, and his Inter Service Intelligence agency, the ISI did, but the money to do it came from Reagan and the Saudis. Reagan and his minions funded the ISI to create the Afghan insurgency against the Russians, but total operational control was vested in Pakistan and the ISI. Charlie Wilson, the Democratic Congressman (and eponymous hero of Charlie Wilson's War) had bought into a propaganda film produced by a glamorous and politically connected socialite who had become a fan of Zia and his insurgents. The film featured a heroic Mujaheddin leader but didn't mention his early career throwing acid into the faces of women in Kabul who went out without their faces covered and provided bipartisan support for giving the ISI everything it wanted.
With full operational control, the ISI had plenty of resources left for building itself into panoptican styled on the KGB, and for fomenting trouble among Indian Sikhs and in Kashmir. But the ISI still had a mission in Afghanistan after the Soviets withdrew - ensuring that Afghanistan was ruled by Islamists friendly to Pakistan or kept in turmoil.
The Taliban and al Qaeda were the result.
ISIS is a simpler story. After Bush Too's war in Iraq, his idiot proconsul Paul Bremer turned the Iraqi army out without jobs or pensions - but with weapons.