Earlier quoted context omitted.
That's a very complicated honey trap to set up. And it's a failure on both the accounts that elected leaders should protect its people before things escalate and secondly elected leaders aren't supposed to set up trap like this in the first place.
Leaders democratically elected or otherwise are people seeking power, in general the democratic leaders do not cross a line, but Erdogan has proven he is not your "normal" elected leader. Nobody benefits from a failed coup like Erdogan, he now has the license to make Military in his image and the last pillar of secularism in Turkey is Kaput!
I see this latter failure as a general failure throughout the way the West interacts with Islamic nations. We've allowed secularism to become a tarnished brand, associated with military strong-men, instead of promoting it as the way to rights and education for women and freedom from religious totalitarianism.