All wars are caused by political issues, as Clausewitz pointed out long ago. The specific issues of the American Revolution and the Soviet-Afghan wars were completely different, but there were violations of one people's rights by a foreign government in both instances.
In the American revolt the issues revolved around the changing situation in the colonies of the New World. These colonies originally had independent local governments under the British Crown, but things had changed since the founding of the colonies. After the French and Indian War the cost of British military protection for the colonies skyrocketed, with garrisons needed for much larger areas. The threat from French forces west of the British colonies and the Spanish in Florida were very real, as well as continuing disputes at sea and in the Caribbean. The British Parliament felt that the colonies should be paying their fair share of the costs of that military and naval protection, but the colonies viewed Parliament's demands as interference of their traditional rights. All of the troubles involving the Stamp Act, the Intolerable Acts, etc. grew out of this basic issue.
The Soviet-Afghan War was very different. Afghanistan had developed close ties with the Soviet Union as early as the 1950s, especially in relation to military purchases and training. In 1973 Prince Muhammoud Daoud seized control in a military coup, and initiated ever closer ties with the Soviets. Unfortunately, Afghanistan has never been a country of political stability, with many conflicting tribal traditions. It was a land noted for Buddhist universities before Islam arrived, and although some tribes are quite liberal in some aspects of culture others are extremely limited in personal freedom. This was not changed by Daoud's government, nor those which followed. Although the government of Nur Mohammed Taraki liberalized much of Afghanistan's laws, including the personal, cultural and political rights of women, the country fell increasingly into anarchy with tribal groups such as the Pathan agitating. Violence and blood feuds had always been a large part of Afghan tribal cultures, and the trade in weapons, opium and hashish endemic. Taraki had seized power with the violent overthrow of Daoud, and he was eventually killed by political opponents also.
In 1979 Prime Minister Hafizullah Amin requested military help from the Soviet Union. After Taraki's death the Central Committee of the Communist Party (USSR) decided on direct military intervention in Afghanistan, and installed Babrak Karmal as Prime Minister and to various other offices. Many Afghans disliked Karmal's governmental policies, and resented the intrusion of foreigners.
So the American Revolution was essentially begun by political agitation aimed at equal rights for American colonists in relation to citizens in Britain, although colonists actually were much better off than the average British subject. The Soviet-Afghan War was the result of political instability in a fragmented Afghan society, and the potential for that instability to adversely effect the USSR.