In addition to ohwilleke's answer seems to me there are added disadvantages to relying on PMCs in times of actual sustained combat.
Militaries, even in rule-of-law/democratic countries, have harsh penalties available to compel personnel to remain at the front, under the umbrella term of desertion.
Taking the US as an example:
The 2012 edition of the United States Manual for Courts-Martial states that:
Any person found guilty of desertion or attempt to desert shall be punished, if the offense is committed in time of war, by death or such other punishment as a court-martial may direct, but if the desertion or attempt to desert occurs at any other time, by such punishment, other than death, as a court-martial may direct.
PMC personnel leaving combat zone out of self-preservation would not automatically be chargeable under those offenses, but may rather fall under contractual/employment/ or applicable civilian laws, which may be inadequate to force people to face deadly risk and which will take months or years to bring to court.
For example, cowardice as in (June 2023) Parkland school shooting: Jury selection begins as Parkland school resource officer Scot Peterson faces a rare trial over police conduct in a mass shooting on campus | CNN is only now getting to court:
Scot Peterson – who retired from the Broward Sheriff’s Office as scrutiny of his conduct during the February 2018 shooting at Marjory Stoneman Douglas High School mounted.
Granted, you might very well be able to strengthen penalties and promise swift justice when operating under martial law, but then doing so also means you don't benefit as much from the PMC's "off the books" / deniability status.
Likewise, armed force personnel often have to take Military Oaths typically swearing to uphold the laws and constitution of their country and soldiers and officers tend to take these quite seriously.
Finally, there is the question of cost.
For a modern military, it will fall be driven by the following buckets:
- gear and maintenance
- training, including large scale drills
- pay
- benefits, including family relocation expenses
If you're hiring security guards for your embassies, then you can probably save on the benefits, gear is negligible and training can be addressed by hiring ex-military types.
But if you are using a domestic PMC, with heavy gear, for actual combat operations, then it hard to see who is bankrolling those expenses besides yourself and the direct pay component may be quite a bit higher than regular military as a mercenary's motivations are, by their nature, financial. As another answer says, you may also be facing uncertainties regarding the training.
Remember, all that spiffy Wagner gear, like the Pantsir that shot down the Russian choppers? Bankrolled by the Russian taxpayer.
Though it's not just combat operation costs, look at Contractors reap $138bn from Iraq war | Financial Times (2013)
None has benefited more than KBR, once known as Kellogg Brown and Root. The controversial former subsidiary of Halliburton, which was once run by Dick Cheney, vice-president to George W. Bush, was awarded at least $39.5bn in federal contracts related to the Iraq war over the past decade.
In a poor country, or a country with a limited military, like Costa Rica, facing a sudden, well-defined, security emergency, maybe importing a PMC's gear and know how would make sense. You pay, expensively, but you are getting a capability you never developed.
A country like Mali, facing an insurgency (COIN)? A PMC could bolster your troops, if your primary problem is combat capacity. But most COIN wars aren't lost by a military force being outgunned, but rather by a military force not "winning hearts and minds" and foreign mercenaries are unlikely to be an optimal way to achieve that. Wagner's forays in Mali seem to be textbook examples of what not to do.