Erdogan's international policies are the consequence of his perception of his country. He wants to have a region "under Turkish influence" and found that since the European Union won't accept Turkey's accession (
unfair IMO), the Middle East makes the perfect alternative.
But the only way to enter the Middle Eastern politics is to try and prove that you are a pious Muslim - the ideal Muslim. Erdogan was already conservative when he was the mayor of Istanbul and was well-known for conservative personal views. However, there is a long road between conservative and downright radical, that he may seem to have covered since his political ascendance 17 years ago.
The problem is, instead of focusing on policies centred around his region, the man has started picking up fights and intervening in matters that are way beyond his scope of understanding or control. Turkey has been a valued member of NATO and is one of the few countries that is licensed to manufacture the F-16 jet under license. Turkey has access to cutting edge electronic warfare systems from USA and other European countries and can easily collaborate with these powers to develop their own systems.
But because of one stupid insistence of the Russian S-400 missile (which is the best in the market), he lost the trust of the entire NATO. It is a matter of time before NATO votes Turkey out if he continues with this attitude. To make it worse, Erdogan has been lashing out at everyone in the region - Israel, Egypt, Lebanon, Greece, the UAE, Armenia and Cyprus. While each of these countries is no match for Turkey (except Israel), when combined together, they can economically and militarily join hands and deliver some serious punishment to Erdogan's ego.
The sad part about all this is that the common Turks are not being heard. Correct me if I am wrong, but the educated and capable Turkish youth is
leaving the country.
As someone for whom the entire world is a working space and has spent quite some time in Turkey, I feel sad. Before Erdogan's extra-regional aggressions, I had a great time in your country - the food, the music, the cultural aspects, the general warmth of the common Turkish people were all quite nice.
Let's hope he at least mends his fences with all those countries that he picked on, including us Indians. I don't know what has gotten into him to pick on us who are over 3000 Kms away from his furthest borders.