Some the 2016 coup was staged by Erdogan, some say it was a fumbled attempt by part of the military. As an outsider it's hard to say what happened. What I can say is that Erdogan used the failed coup attempt for the Cleansing of all Cleansing. You wouldn't even believe how many people were put in jail or lost their jobs. He came down hard on anybody who was considered critical of the regime, in several waves apart in time.