It's interesting that Erdogan rode this train to domination on the back of a religious party that was a counterreaction to the secular, albeit somewhat authoritarian, state.
Then the "Deep State" itself reacted and tried to purge him (doing the right thing, the wrong way) and were unsuccessful.
And now, here he is, Turkey's Franco, the beneficiary of a legal coup. Arguably, Turkey is now in a much worse place with him at the helm, than if the military had been successful in the 2016 coup attempt. [It's very curious that we still don't know who sponsored the attempt-- it certainly wasn't Gulen.]