Even when accounting for the persecutions, genocides, and exodus that culminated in the population exchange of 1923, the sizable Greek population of Istanbul (~200,000) remained in Turkey, having been specifically exempted from removal in the Lausanne Treaty. Yet, despite having been granted special permission to remain in their home city, even this remnant Greek population of Istanbul continued to rapidly decline in the ensuing decades. Why?
As you correctly mentioned in 1914 the ethnic Greek population of the Ottoman Empire numbered around 2 million on the eve of WW1, and they were primarily concentrated along the coastal areas, from the Greek quarter of Constantinople, to the cities of Smyrna (Izmir) and Adrianople (Edirne) etc. and in Pontus (home to Pontic-Greeks) in cities like Trebizond and along the Pontic mountains, and some enclaves in central Anatolia home to the Cappadocian-Greeks etc. and many other Greek subgroups.
Here were the main events that triggered Greek exodus in the 20th century, and after the background I'll mention what happened to the Greeks of Istanbul.
During WW1, the Ottoman Empire persecuted Christian minorities, the first to go were the Armenians who lived near the Caucasus frontline and were accused of 'disloyalty' and siding with Tsarist Russia, but the pogroms later expanded to include Greeks and Assyrians and other Eastern Christian groups who were all accused of conspiracy. For example the Pontic-Greeks lived near the frontline and alongside Armenians, and they suffered a similar fate in the Armenian Genocide.
What helped most Ottoman-Greeks during this time of genocide was the fact the Kingdom of Greece was neutral under King Konstantínos from 1914-1917 because he was aligned towards Germany. So the Germans pressured the Ottomans to avoid targeting the Greek population in a bid to win over Greece to the Central Powers. Greece however deposed Konstantínos in 1917 in a coup initiated by the nationalist faction led by Eleftherios Venizelos with the support of the Entente, and he was replaced by his son Aléxandros. The Greeks suffered far worse in the last few years of the Ottoman Empire because they were now treated as the "enemy", the same as Armenians.
Greece pursued territorial claims on the Ottoman Empire in the Treaty of Sevres, with the goal of finishing unification by taking Constantinople, Ionia, Thrace, and what they claimed were the last Greek lands under Ottoman-rule. Greece fought a war against the defiant Turkish nationalists led by Mustafa Kemal, who revolted against Sevres and the Turkish ended up winning this war and driving the Greek population out of Anatolia along with the army. In the Treaty of Lausanne a mutual population exchange was agreed to in 1923 to remove all Greeks (with the exception of Istanbul), and in reality this meant all Christians since many Turkish-speaking Christians were also deported to Greece, and vice versa Muslims (mostly Greek-speakers) were deported from Greece.
Many Greeks remained and lived in the new Turkish nation-state during the 1920s and 1930s, and enjoyed more or less equal rights under the secular Turkish Republic. However here were the main events that triggered them to leave.
The first was the anti-Christian and anti-minority "Varlık Vergisi" tax (1942) that targeted Armenians, Greeks, and Jews alike. This wealth tax (basically a modern form of Islamic jizya) was applied to all non-Muslim citizens of Turkey, who had to pay an average of 100-200% more taxes compared to the average Muslim, and this depended on group. The 'hated' Armenians had to pay over 230% in taxes while Greeks faired slightly better at 150% in taxes, and Jews were somewhere in between. The purpose of the tax was to raise funds for a possible Turkish entry into WW2 and to inflict financial ruin on non-Muslims and redistribute said wealth to Muslims. As a result of this discriminatory tax, that wasnt repealed until 1944 as a result of pressure from the Western Allies, many thousands of Greeks left Turkey after the war when they were given the opportunity.
The next event was the infamous Istanbul pogrom of September 1955, that decimated the Greek quarter of Istanbul and drove several tens of thousands to flee. This was akin to the 1938 Kristallnacht initiated by the Nazis.
The pogrom was initiated by the government of Adnan Menderes, during the beginning of the Cyprus dispute. A bomb placed by Turkish intelligence agents exploded at the childhood house of Mustafa Kemal "Atatürk" in Thessaloniki, causing little damage to the building and killing/injuring no one but it made the headlines in Turkey where the blame was placed on EOKA, a Greek-Cypriot nationalist group. Riots broke out targeting Istanbul's Greek community. Turkish nationalists murdered thirty Greeks, and Greek owned stores were looted, Churches were desecrated and the tombs of Greek patriarchs were destroyed etc. After these few days of total chaos, and the Turkish army allowing the mobs to run their course, many Greeks decided to pack up and leave.
The Varlık Vergisi tax and the 1955 pogrom were the two main events to tigger Greek exodus from Istanbul, but there were many smaller events over the years and a general rise in anti-Greek sentiment during the 1950s and 1970s as a result of the Cyprus dispute that led the Greek population to fall from 119,822 in 1927 to about 7,000 by 1978, and to the 3,000 you cited today.