Tahiyatul Masjid is saying a hello/welcome to the mosque. Greeting and respecting the sanctity of the mosque. Every mosque is the house of Allah. Masjid al Haraam is a bit different. Vast majority of people are those coming for Umrah and those doing the first tawaaf of Hajj. The rule is that anyone who enters haraam should go for a voluntary tawaaf.
Tawaaf is special in the sense that it cannot be done anywhere in the world, it is specific to Kabah.
Do your tawaaf and then offer the 2 rakat of Tahiyatul Masjid later on, don't offer 2 rakat salaah before tawaaf. If you are there for other purpose then treat the haram like a normal masjid and pray 2 rakat. Although make sure you go as close as possible.
Shaykh Abu Eesa answers and explains...
No transcription found