Praise be to Allah.
The Sunnah of the Messenger of Allah (blessings and peace of Allah be upon him) is to start with tawaaf before doing anything else, as was clearly stated by Shaykh al-Islam Ibn Taymiyah in his Mansik, where he said: After entering the mosque, the Prophet (blessings and peace of Allah be upon him) began with tawaaf, and he did not offer any prayer before that to greet the mosque (tahiyyat al-masjid); rather the greeting for al-Masjid al-Haraam is tawaaf, circumambulating the Ka‘bah.
It was narrated from ‘Urwah, from ‘Aa’ishah (may Allah be pleased with her), that the first thing the Prophet (blessings and peace of Allah be upon him) did when he came to Makkah was wudoo’, then he circumambulated the Ka‘bah. Al-Bukhaari (1614) and Muslim (1235).
Al-Haafiz ibn Hajar said:
In this hadith, we see that it is mustahabb for the one who is newly arrived in Makkah to start with tawaaf, because that is the greeting for al-Masjid al-Haraam. Some of the Shafaa‘is and those who agreed with him made an exception for a beautiful or noble woman for whom it is not appropriate to stand before people; it is mustahabb for her to delay tawaaf until night-time, if she enters the city by day. The same applies to one who fears missing a prescribed prayer, or a prescribed prayer in congregation, or a Sunnah mu’akkadah (confirmed Sunnah prayer), or a missed prayer that he needs to make up; all of that takes precedence over tawaaf.
End quote from Fath al-Baari (3/479)
In this case, the Sunnah mu’akkadah congregational prayer takes precedence over tawaaf.
Ibn Qudaamah said:
If he enters the mosque and remembers an obligatory prayer or a missed prayer that he needs to make up, or the iqaamah (call immediately preceding prayer) has been given for an obligatory prayer, then he should give precedence to that over tawaaf, because that is obligatory and tawaaf is a greeting [of the mosque], and because if the iqaamah for prayer is given whilst he is doing tawaaf, he should interrupt his tawaaf in order to join the congregation. So it is more appropriate to start with the prayer. if he fears that he may miss the two [Sunnah] rak‘ahs of Fajr, or Wirt, or if a deceased person is brought for the funeral prayer, then he should give precedence to those prayers, because they are Sunnahs that it is feared he will miss, but tawaaf cannot be missed [because it may be done at any time].
End quote from al-Mughni (3/337).
From this reasoning it may be understood that praying Taraweeh with the imam takes precedence over tawaaf, because it is a sunnah that it is feared he will miss.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was asked: Does the pilgrim who is performing Hajj or ‘umrah have to interrupt his tawaaf or sa‘i in order to pray?
He replied: If the prayer is obligatory, he must interrupt his tawaaf or sa‘i in order to pray, because prayer in congregation is obligatory, and he is allowed to interrupt his sa‘i in order to pray in congregation. So his exiting sa‘i or tawaaf is a permissible interruption, and his joining the congregation is something obligatory.
But if the prayer is naafil (supererogatory) – such as if it is qiyaam al-layl, i.e., Taraweeh in Ramadan – then he should not interrupt sa‘i or tawaaf for that.
But the best is to plan his time so that he can do his tawaaf after qiyaam al-layl (Taraweeh) or before it, and the same applies to sa‘i, lest he miss out on the virtue of praying qiyaam al-layl with the congregation.
End quote from Majmoo‘ Fataawa wa Rasaa’il ash-Shaykh Ibn ‘Uthaymeen (22/350-349).
Based on that:
If someone enters al-Masjid al-Haraam for ‘umrah a few minutes before the adhaan for ‘Isha’, then he may delay ‘umrah until he has finished praying Taraweeh with the imam, so as to combine both virtuous deeds.
And Allah knows best.