The Reichstag fire was blamed on the communists by the nazi party to brand them as traitors much like the coup is being blamed on the Gulen movement (which had a fall out with the AKP, Erdogan's ruling party). All signs point to the coup not being related to the Gulen movement at all and a lot of Erdogan's actions post-coup have been publicly justified with allegations about the Gulen movement that are obviously blatant lies.
Whether the coup itself was staged by Erdogan like the Reichstag fire was staged by the nazis is debatable. I personally think it was inevitable given the history of Turkey but it was carried out so incompetently and with little to no support from the military leadership that it's at least possible that it was intentionally made to happen the way it did (e.g. using agents provocateur to trigger the coup at a time when it was doomed to fail).
I don't think the actual soldiers who carried out the coup were knowingly working for Erdogan, them simply being "useful idiots" is far more likely. Either way, if you ask "cui bono?" all answers point to Erdogan and the AKP.