There are powerful lawful deities in every setting, most small and every large or larger city will have 9th level clerics who can cast the spells. The main reasons for it not to work are either the DM being against it, the fact that if the clerics are trusted enough to run elections they'd probably just be in charge already, the fact that like most optimization it relies on information people don't normally have (details of how deities work), or no one having thought of it. So plenty of reasons, but most of them not any worse than anything else.

Regarding the "make a spell to do it" solution, Towers of High Sorcery has a bunch of specific purpose spells including one that. . . sends a message to all the wizards of high sorcery for a vote and gives you the result. They made it a 9th level spell (not inappropriate when compared to Sending after all), so it's even more restricted than Commune, but for people that want a precedent there is a published book with a vote spell.

Personally, I'd expect anyone ready to haul out a bunch of magic to safeguard the people's election ought to be aware of the mechanics involved. If they know enough about divinations and espionage magic to actually address the problem, they can probably guess that the only secure point will be a top-tier deity, unless the "election" is so small it need hardly be called an election. And furthermore that while they're worrying about electing some mortal with all the usual foibles, the planes are full of extremely powerful immortal exemplars of whatever mix of ruling alignments they desire who would probably be better at it.