There are very few actual democracies in existence today. There is a reason most democratic countries don't put every decision to a public vote and why there are often certain laws no government is allowed to change. You can agree or disagree with the priorities Atatürk set in place but from his point of view even an elected leader can become a traitor and enemy of the state and it's the duty of the military to stop him (because they are the only power not directly under the government's control and are able to resist with force if necessary unlike e.g. supreme court judges).