In 2014, flight MH17 from Amsterdam, en-route to Kuala Lumpur, was shot down by the Russian military during their clandestine operation in the east of Ukraine. Airlines are very cautious with active war zones since.
Odesa is in Ukraine, and is under frequent military attacks. The flight route from Odesa to Tehran would take the aircraft over Crimea, occupied Ukrainian territory and part of the war zone. Large part of the Black Sea is considered a risk area as well, due to Russian fleet operations.
Furthermore, due to sanctions, western airlines do not fly through Russian airspace.
The routing through Turkey is limited to a few routes, with limited capacity.
The results is the route your flight took.

Note that it avoided Afghanistan as well.