This excerpt is taken from the book of Sheikh al-Islam Imam Ibn Taymiyyah, may Allah have mercy on him, Al-Jawab al-Bahir fi Zuwar al-Maqabir, translated by Sheikh Ataullah Saqib.
Masjid al-Haram:
The honor of constructing Masjid Al-Aqsa and Masjid An-Nabawi, along with the third mosque, belongs to four Prophets, peace be upon them, who invited people to travel to these mosques for worship. Apart from these mosques, no other mosque has been built to which people are commanded to travel for worship. It should also be remembered that there were other mosques where the Prophets, peace be upon them, offered prayers, but people were not instructed to travel to them, just as Prophet Ibrahim, peace be upon him, prayed at places other than the Kaaba, yet people were only invited to perform Hajj at the Kaaba.
None of the Prophets invited people to travel to their graves, homes, or any other sacred place; rather, they invited them to worship Allah alone, without any partner. After mentioning the resolute Prophets, Allah Almighty says:
ذَٰلِكَ هُدَى اللَّهِ يَهْدِي بِهِ مَن يَشَاءُ مِنْ عِبَادِهِ ۚ وَلَوْ أَشْرَكُوا لَحَبِطَ عَنْهُم مَّا كَانُوا يَعْمَلُونَ ﴿٨٨﴾ أُولَٰئِكَ الَّذِينَ آتَيْنَاهُمُ الْكِتَابَ وَالْحُكْمَ وَالنُّبُوَّةَ ۚ فَإِن يَكْفُرْ بِهَا هَٰؤُلَاءِ فَقَدْ وَكَّلْنَا بِهَا قَوْمًا لَّيْسُوا بِهَا بِكَافِرِينَ ﴿٨٩﴾ أُولَٰئِكَ الَّذِينَ هَدَى اللَّهُ ۖ فَبِهُدَاهُمُ اقْتَدِهْ
“This is the guidance of Allah with which He guides whom He wills among His servants. But if they had associated others with Allah, then all that they were doing would have been of no benefit to them. Those were the ones to whom We gave the Scripture, the judgment, and the prophethood. But if these people deny it, then We have entrusted it to others who do not deny it. O Prophet! Follow the guidance of those who are devoted to Allah. “
Reference: (6-Al-An'am:88-90)
In light of the above evidence, it is established that it is not permissible to remove these three mosques from their original locations and build them elsewhere. As for other mosques, their virtue is understood in the sense that they are houses of Allah where His worship is performed, and this is a common attribute found in these mosques as well as other mosques. There is also a difference among these three mosques in terms of the amount of worship performed or the age of the mosque. Such differences also exist among other mosques. If traveling to them for this reason were Sunnah, then traveling to ordinary mosques would also have been commanded.