Turkish President Recep Tayyip Erdogan has used the first anniversary of a coup attempt against his government to accuse an erstwhile ally of treason.