At this point of date and time, there's nothing we can know for sure. Only in maybe 60 years in the future, when Erdogan's regime would enter into history and scholars could study the subject on a neutral and objective point of view, this question will be answered.
Where he has gotten his inspiration from is obvious. Read the intro of the following wikipedia article, and compare with today's events in Turkey. The similarity is staggling. https://en.wikipedia.org/wiki/Night_of_the_Long_Knives
- Hitler was elected deomcratically, just like Erdogan was
- Hitler's populatrity quote was extremely high, just like Erdogan.
- One principal culprit which is accused of making a putsch is found, Ernst Röhm for Hitler and Fethullah Gülen for Erdogan. In both cases they were former friends of the dictator which are punished for openly disagreeing with him.
- Before the night of the long knifes, public order was repeatedly disturbed by the SA, which terrorized the population. By wiping them out, Hitler appeared as the man who stabilized Germany and bring social peace to the country. In Turkey's case, the Islamic State plays the same role - it was an ally of Turkey but now everything changed.
The only difference, so far, is that Erdogan is in power since longer than Hitler was in 1934, and that Gülen is still alive, for now.
There is no evidence, but clues that the Putsch was a masquerade:
- The most successful part of the Putsch was getting to the TV, in order to make sure everyone was informed
- A significant part of the army did not participate in the Putsch - if it was geniune then the army would have been united for it.
- It happened while the parliament was empty and Erdogan in holidays - normally the one thing that happens in a genuine Putsch is that the government's key members are taken prisoners.
This is pure speculation of my parts, but some of the so called attempts could have been engineered by Erdogan as well to scare the population, in order to get more popular support, and in order to be credited to having been able to restore order (just like Hitler).