This.
Turkey apologized to Russia, and normalized relationships with Russia and Israel. Also their Foreign minister talked about mending ties with Syria - Assad's Syria.
All this happened in the space of a few weeks. It was such an about-face from their past postutring. I guess this puts things in context.
I think the coup is related to the recent position of Erdogan towards Russia.