For years, Mr. Erdogan, an Islamist, has celebrated great moments of the Ottoman past when Istanbul was the seat of the Islamic caliphate, and played down Turkey’s secular history established by Ataturk. With last month’s failed coup, he now has his own story, and he has wasted little time propagating his own set of events and symbols to cement the narrative in the national consciousness. ...
Mr. Erdogan is trying to create a new narrative of a Turkish Islamic identity “that reaches beyond” what Ataturk built. Other analysts say Mr. Erdogan is essentially using the coup events to create a founding myth of an Islamist Turkey.
Imagine the coup plotters being worried that Ergodan would take Turkey in an Islamist direction!
UPDATE: I will say that I agree that after whatever wobbles the coup attempt and purge have on US-Turkish relations, Turkey has an interest in having America as an ally rather than Russia.
The US is far with a record of leaving when asked. The Russians have a record of many wars with Turkey (as the Ottoman Empire).
So I don't expect a flip with Turkey exiting NATO and courting Russia as an ally.