Since December 2017 the Iraqi airspace is used by Emirates again, after Iraq declared the victory over the Islamic State.
Now there are basically two routes to choose between when flying from Turkey to Dubai.
One route passes through Iran and make it look like the flight is explicitly avoiding Iraq. The route crosses the Ankara FIR / Tehran FIR border just north of Iraq, before turning south towards Dubai, such that it just stays outside Iraqi airspace.
The other route (UM688) passes through Iraq and makes it look like the flight is explicitly avoiding Iran. The route structure in Iraq is such that the north-south routes follow the Iran border in order to avoid the military activities near the Syrian border.
The map below shows the route structure with two routes through Iraq highlighted (UM688, Southbound and UM860, Northbound).
source: Flight Service Bureau
It is likely that the choice of route is made based on financial reasons. From looking at recent flights, Emirates seems to have a preference for flying over Iraq, but occasionally flies over Iran.
The ATS overflight fees of Iraq are at \$3751 (approx. \$0.38 per km) considerably cheaper than those of Iran. Iran charges \$0.004061 per 1000 kg Maximum Take-off Mass (MTOM), per KM, with a 30% reduction for the MTOM in excess of 150 000 kg. For an A380, the cost of crossing Iran would be approximately \$2800 (approx. \$1.80 per km). The slightly longer flight over Iraq, Kuwait (~\$1351 ATS fees) and Bahrain (~\$2101 ATS fees) would consume more fuel but will still be cheaper than crossing Iran.
A reason for crossing Iran occasionally might be that Iraq's airspace is very congested since the re-opening of the airspace. To avoid delays, sub-optimal altitudes or adverse meteorological conditions it may be more attractive to cross over Iran in certain situations.
1sources of the ATS Fees: AIP's of the respective states, section GEN 4.2. As high volume users, Emirates may have negotiated better rates.