Fully believe in the possibility that Erdogan orchestrated the military coup as a means to deny the Gulenists any legitimacy, as well as enact his great “Purge” in the public sector.
Another piece of evidence that the coup was designed to fail? Military coups, by nature, require the death of the ousted leader — or there will always be supporters aiming for the leader’s reinstatement. So why then, did the military carry out the coup when Erdogan was gone and to your point, not execute him when they had the opportunity? It’s because, as you said, it was designed to fail.