Maybe Erdogan wants to build his own Islamic Caliphate. Democracy rarely works in Muslim countries. They prefer sharia and other medieval forms of government.
You need to remember that Turkey is not a very homogeneous society. In the Western part and the coast, the people are quite secular and opposed to Islamism. Also, in the South-east the Kurds oppose Islamism of Erdogan and his AK party. If Erdogan converts Turkey in to an Islamic Caliphate, then the West and the South-east will break away.