First of all, it should be clear that to visit Madinah is not a rite of Hajj or `Umrah, but the unique merits of the Prophet’s city, his mosque, and his sacred tomb attract every pilgrim or one performing `Umrah to visit it. One may choose whether or not to visit Madiniah, and whether to do so before or after the Hajj or `Umrah. There is no ihram or talbiyah for the visit to Madinah or the Prophet’s Mosque.
Pilgrims can also go to Madinah first through Jeddah, before making the intention for Hajj. From Madinah you can make the intention for Hajj and to wear ihram from Madinah bearing into consideration that your miqat in that case is the miqat of people of Madinah which is abyar `Ali.
Almighty Allah knows best.