Although from an outside perspective a military coup seems completely undemocratic the Turkish military has historically had the role of maintaining the principles Atatürk founded the Turkish Republic on. You can think of them as a built-in correction mechanism in case the government veers too far off course -- they remove the government, reset everything to start and then hand over control back to the people once th…
Karl Popper considered a government democratic if it could be replaced without violence, and while that's not exactly my definition, I think it's a good start - a bare minimum. A provision in the constitution for military coups doesn't excuse it. That just means the Turkish constitution is a bad one, that doesn't offer its citizens democracy. Handing over control to the people "once the situation is stable again" is…
In my opinion democracy is only a tool, not goal. And I think sometimes (Kemalist Turkey is one example) it's better for a society to not implement "pure" democracy in the name of better values like secularism, freedom etc.
UK/Brexit is also a good example of majority of people being stupid and hurting themselves by using democracy.