A good book for the history of it is The Gun (https://www.amazon.com/Gun-C-J-Chivers/dp/0743271734). Its essential point is that weapons of war are usually very durable goods, and outlive the geopolitical purposes for which they are produced and originally distributed. Kalashnikov-family rifles happen to have arrived in particularly unstable places.
EDIT: Weapons built by local forces tend to be more... idiosyncratic. Though compatibility with AK ammunition is a desirable feature. https://atwar.blogs.nytimes.com/2012/08/08/taliban-gun-locke...
Also, another example of this durability is the Humvees that have ended up in Syrian government hands after going through three different owners - US, Iraq, ISIS, Syria.
And Syrian rebels found and used a cache of mint-condition StG 44 rifles in 2012.