Not the way you meant, but I think poverty plays a role. That in a country where almost everyone is poor, opportunities for advancement are practically non-existent, and the only source of wealth is squeezing the populace (or controlling the few profitable extraction-export industries), the police/gendarmes/military is one of the few ways for poor nobodies to have a stab at wealth. Granted being a patrolman or private at the bottom of the totem pole sucks, but it still doesn’t suck quite as much as being an impoverished slum dweller. There’s always some graft to be had, you get the fringe benefit of being one of the bullies instead of the bullied, and if you can climb the ladder the graft and status becomes richer. This guarantees that regardless of who’s running things at the top, the muscle to keep the peons in line will be there. It’s when the rank and file grunts desert and throw their lot in with the peasants that revolution is imminent.
Poverty can be related to coups, but it is a relatively weak motivator. It does not necessarily follow that poverty itself is an impetus for a coup, largely because (A) a country can be poor but politically stable and (B) coups are usually perpetrated by the upper-level military types. If the great mass of proletariat peasants overthrows the government, we are technically talking about a revolution and not a coup.
Political disorder, corruption, and insecurity are all major predictors of coup attempts, but the single biggest predictor might be an over-emphasized faith in the military. Most of these countries are very divided and chaotic, and so people begin to believe that a military dictatorship would be preferable to the otherwise corrupt or inept government. Poverty is a driver only so far as it contributes to corruption and social disorder.
There’s an idea out there called “relative deprivation theory” which claims disorder and violence can increase when the impoverished feel like they are being denied opportunities. (Eg “People around me have greater wealth and luxuries, and I am being unfairly denied these same things, so I will join a terrorist group in order to get what I think I deserve”). If this hypothesis is correct, the dissatisfaction may drive crime, corruption, class warfare, terrorism, and other forms of disorder. This disorder would then in turn make people support a military coup if it promises to restore order.
I also agree very much with the idea that people might look to a coup as a way to upset the hierarchy and move up in the world, under certain circumstances. We saw this very clearly in Iraq. After the 17 July coup, the military became the ruling class in Iraq and belonging to a military family became the key to social mobility.
Bottom line, this happens when there are a large number of people with little or nothing to lose. Keep almost everyone fed, with houses and cars and in relative safety and you can perpetuate virtually any form of government you’d like.
Also especially if your soldiers are among those disgruntled poor. Fail to provide a decent stable life for most of your soldiers and they will take it by force.
Expanding a little, they are carried out by generals and such because if the soldiers arent provided for, the general can easily garnish their support.
If the soldiers believe the chance is higher of improving there lives than making them worse. That’s all it takes.