The CIA sponsored the Mujaheddin, not the Taliban, to fight the soviets who had invaded to support the then communist government.
The Taliban were ethnic Pashtuns who were supplied, educated, and supported by the Pakistani Government in the 2nd civil war which followed the defeat of the Soviets. Al Qaeda is more closely linked to the Mujaheddin.
Mohammad Daoud, after taking power in a coup, had tried to carry out badly needed economic and social reforms but met with resistance and had little if any success. Mr. Daoud then turned on his opposition, killing the leader and trying to imprison the rest. Some Military brass escaped (future warlords) and start a resistance/uprising which is when the Soviets were invited in by Mr Daoud. The resistance grew into the Mujaheddin and so on.
The CIA was sponsoring the Mujaheddin prior to the invasion of the USSR and they were the ones causing revolt in the Government that was seen as being pro-communist.
"Question: The former director of the CIA, Robert Gates, stated in his memoirs ["From the Shadows"], that American intelligence services began to aid the Mujahadeen in Afghanistan 6 months before the Soviet intervention. In this period you were the national security adviser to President Carter. You therefore played a role in this affair. Is that correct?
Brzezinski: Yes. According to the official version of history, CIA aid to the Mujahadeen began during 1980, that is to say, after the Soviet army invaded Afghanistan, 24 Dec 1979. But the reality, secretly guarded until now, is completely otherwise: Indeed, it was July 3, 1979 that President Carter signed the first directive for secret aid to the opponents of the pro-Soviet regime in Kabul. And that very day, I wrote a note to the president in which I explained to him that in my opinion this aid was going to induce a Soviet military intervention.
Q: Despite this risk, you were an advocate of this covert action. But perhaps you yourself desired this Soviet entry into war and looked to provoke it?
B: It isn't quite that. We didn't push the Russians to intervene, but we knowingly increased the probability that they would.
Q: When the Soviets justified their intervention by asserting that they intended to fight against a secret involvement of the United States in Afghanistan, people didn't believe them. However, there was a basis of truth. You don't regret anything today?
B: Regret what? That secret operation was an excellent idea. It had the effect of drawing the Russians into the Afghan trap and you want me to regret it? The day that the Soviets officially crossed the border, I wrote to President Carter: We now have the opportunity of giving to the USSR its Vietnam war. Indeed, for almost 10 years, Moscow had to carry on a war unsupportable by the government, a conflict that brought about the demoralization and finally the breakup of the Soviet empire.
via marxists.org"
That isn't to say they didn't remove the old elite in a brutal fashion, without that removal the new reforms would not have been possible. That reform was well under way and the CIA funded the campaigns that were against it. They backed the remnant of the 'old guard' and that is who was in power after the USSR left. Change the name and the same names can be found in both organizations.
"During its first 18 months of rule, the PDPA brutally imposed a Marxist-style reform program, which ran counter to deeply rooted Afghan traditions. Decrees forcing changes in marriage customs and pushing through an ill-conceived land reform were particularly misunderstood by virtually all Afghans. In addition, thousands of members of the traditional elite, the religious establishment, and the intelligentsia were imprisoned, tortured, or murdered.[8]
Taraki was also responsible for introducing women to political life. A prominent example was Anahita Ratebzad, who was a major Marxist leader and a member of the Revolutionary Council. Ratebzad wrote the famous New Kabul Times editorial (May 28 1978) which declared: “Privileges which women, by right, must have are equal education, job security, health services, and free time to rear a healthy generation for building the future of the country .... Educating and enlightening women is now the subject of close government attention.”[8]
Taraki as president of Afghanistan attended a conference of the Non-Aligned nations in Havana, Cuba. On his way back he stopped in Moscow to meet with Leonid Brezhnev. Taraki reached Moscow on March 20, 1979 with a formal request for Soviet ground troops. However, according to the Marxist-Leninists of Afghanistan Taraki has only ideological attachment with the former USSR.[8]"
The Taliban's Emergence in Afghanistan: A founder's insights
February 1, 2008
By Wakil Ahmad Mutawakil
How the Taliban emerged
The Taliban, as the name would suggest, were religious Madrassa students from Pakistan's Madrassas that became an Afghan political movement in the early 1990s. At the beginning, there were two types of Taliban. One group was comprised of former mujahedin, Afghan veterans of the jihad against the Soviets (1979‐1989). These were not the mujahedin commanders who were strengthened because of their wartime exploits. Rather the Taliban were culled from the rank and file of this battle. These were the mujahedin who grew tired of the increasingly tyrannical antics of their more celebrated commanders and to get out from under their hideous command, fled to religious schools in Pakistan to escape the oppression.
The second group of Taliban came from students already resident in Pakistan's religious schools. These were the Afghan refugees who were for the most part too young to have enlisted in the jihad against the Soviets. They were enrolled in Pakistan's religious seminaries, because this was in most cases, the Afghan refugees only educational available educational option. This was how Pakistan's seminaries came to be filled with Afghans. As to how the Taliban came about, the Afghan refugees in Pakistan's religious schools, eventually formed their own political and social organizations to try and address their special needs, and over time one of these groups metamorphosed into a genuine movement that would become known all over the world: the Taliban.
May 1979: CIA Begins Working with Hekmatyar and Other Mujaheddin Leaders Chosen by ISI
Edit event
As the US mobilizes for covert war in Afghanistan (see 1978 and July 3, 1979), a CIA special envoy meets Afghan mujaheddin leaders at Peshawar, Pakistan, near the border to Afghanistan. All of them have been carefully selected by the Pakistani ISI and do not represent a broad spectrum of the resistance movement. One of them is Gulbuddin Hekmatyar, a drug dealer with little support in Afghanistan, but who is loyal to the ISI. The US will begin working with Hekmatyar and over the next 10 years over half of all US aid to the mujaheddin will go to his faction (see 1983). Hekmatyar is already known as brutal, corrupt, and incompetent. [McCoy, 2003, pp. 475] His extreme ruthlessness, for instance, his reputation for skinning prisoners alive, is considered a plus, as it is thought he will use that ruthlessness to kill Russians. [Dreyfuss, 2005, pp. 267-268]
July 3, 1979: President Carter Approves Covert Aid to Anti-Soviet Forces in Afghanistan
Edit event
President Carter authorizes covert aid for opponents of the Communist government in Afghanistan. Zbigniew Brzezinski, Carter's National Security Adviser, will state in 1998, “According to the official version of history, CIA aid to the mujaheddin began… after the Soviet army invaded Afghanistan… But the reality, secretly guarded until now, is completely otherwise: Indeed, it was July 3, 1979 that President Carter signed the first directive for secret aid to the opponents of the pro-Soviet regime in Kabul. And that very day, I wrote a note to the president in which I explained to him that in my opinion this aid was going to induce a Soviet military intervention.… We didn't push the Russians to intervene, but we knowingly increased the probability that they would.” [Le Nouvel Observateur (Paris), 1/15/1998] After Brzezinski's confession, other US officials who denied US involvement prior to the Soviet invasion will change their story as well. For instance, Charles Cogan, who is head of the CIA covert aid program to Afghanistan at this time, will call Carter's approval on this day a “very modest beginning to US involvement.” [Cooley, 2002, pp. 10] In fact, even this is not correct because the CIA had been aiding the rebels since at least the year before (see 1978 and 1973-1979). The Soviets invade Afghanistan by the end of 1979 (see December 8, 1979).