The question mentions "military coup", but traditionally in Russia (including the Soviet and pre-Soviet times), the military didn't play a significant political role, despite its might. Unlike some other countries (e.g. Turkey, Pakistan, much of Latin America), the army has never been a political actor. This is not just because of the 'watchful eye' of FSB/KGB/etc. (mentioned in Timur's answer), but partly due to the fact that the army has never been a career growth refuge for the smart/educated/ambitious/secular/etc. people, given the difficulty of 'normal' political career (as often happened in those other countries).
And at the top level, any commander showing any signs of independence (e.g. Zhukov) was (and is) quickly replaced.
So, we should broaden the question a bit to include any coup, and most importantly an inter-elite one.
For the coup to happen (let alone be successful), there is a simple necessary condition: the people (whether elite or populace) must realise that they stand to gain more than they lose from the regime change. In a nutshell, Putin created a situation where this condition is not satisfied, particularly for the elite.
Practically the entire political elite owe their wealth and position to the current regime (if not Putin personally). They will only lose from a change. This was reinforced after (and just before) the current war by making the elite 'burn the bridges' and openly declare support, often with escalating vicious rhetoric. There is just no way back.
(There is a somewhat similar situation in North Korea in this regard: the elite (as well as local business, which exists!) actively support the current regime, even if they understand its deficiency. They just realise they stand no chance in case of regime collapse.)
As for the general population, there are several factors. One is, of course, the increasingly repressive environment (the entire internal army, Rosgvardiya, was created specifically to quash any internal dissent). But there is also an ever-increasing share of population directly dependent on the federal budget money (from teachers to military production to the swelled bureaucracy) who, again, stand to lose from change (at least in the short term).
A particularly important sub-section of these people are all the forces (police, FSB, all kinds of military: Siloviki). Apart from swelling their numbers, they were made a truly privileged class: relatively decent pay, very early retirement (at the time when the retirement age is increasing for everyone else), certain immunity from abuse... They stand to lose the most, and will defend the regime in earnest. This is a typical tactics of similar regimes (cf. Venezuela) and is quite effective.
Finally, there is a true belief amongst ordinary people that coups and revolutions always end in turmoil and grief. Russia is quite a survivalist country and doesn't favour radical changes in general.