Firstly I do not think this is about secularism. Turkey is still a more or less a secular country happen to be ruled by a central right - somewhat religious party.
My personal view is that Gulen was involved with the coup, but possibly jocobin nationalist/kemalist fractions in the army was also in the mix.