For all that Greek was spoken in areas of foreign domination,
- It was the prestige and government language in the East Roman Empire—Latin never had a serious chance of displacing it.
- It was the acknowledged and prestige language of the Rum millet under the Ottomans—Turkish never had a serious chance of displacing it, except in Cappadocia where the Greek-speakers were isolated and outnumbered.
- It was the language of the Orthodox population in post-Crusade French/Italian held lands, and there was never a serious attempt to do away with it, even if the Franks weren’t as deferential to Greek as the Ottomans were.
Greek was never threatened. Through those centuries of foreign domination, Greek was never even marginalised.
The one place Greek was wiped out was the Middle East—Egypt, Syria, etc after the spread of Islam, Anatolia after the spread of the Turks. And even the former took a century or so after the Muslims started running Egypt.