Pre-Islamic instances of mosques built over graves:
The following list is merely indicative and should not be treated as exhaustive:
1. Prophet Dawood (a.s.) in Quds, Israel
2. Prophet Ibrahim (a.s.) in Hebron, Israel
3. Prophet Is’haaq (a.s.) in Hebron
4. Prophet Yaqoob (a.s.) in Hebron
5. Prophet Yusuf (a.s.) in Hebron
All these graves were elevated structures of stones and remained in this condition even after the spread of Islam in Quds. (Kashf al-Irteyaab, pg 306)
Even Ibn Taimiyyah admits that the structure over Prophet Ibrahim’s (a.s.) grave existed when Islam reached Hebron and in the very presence of companions, none of whom raised any objection. Only thing is the door to the mausoleum (of Prophet Ibrahim (a.s.)) remained closed till 400 AH.
(Majma’ al-Fataawaa of Ibn Taimiyyah vol 27 pg 141)
list of some instances to prove the point that building graves is as old as Islam itself:
1. Existence of the structure i.e. Prophet’s (s.a.w.a.) chamber inside which he (s.a.w.a.) lies buried. (Akhbaar al-Madinah vol. 1 pg 81)
Initially the Prophet’s (s.a.w.a.) room where he lies buried did not have walls. It was Umar b. Khattab who first constructed walls around it and gave it the shape of a structure.
(Wafaa al-Wafaa be Ikhtiyaar al-Mustafa, vol. 2 pg 521)
In fact, constructing and re-constructing walls around the Prophet’s (s.a.w.a.) grave was an ongoing effort with Ayesha, Abdullah b. Zubair (during his brief reign in Medina) and Mutawakkil, among others.
2. Constructing a mosque over the grave of Hazrat Hamzah (a.s.). (Ibid)
3. Grave of Ibrahim – son of the Prophet (s.a.w.a.) in the house of Muhammad b. Ali b. Zaid. (Ibid)
4. Building a structure over the grave of Ameerul Momineen (a.s.) in the year 372 AH. (Sair-o- Aalam-e-Nobala vol 1 pg 251)
5. Building a structure over the grave of Zubair in the year 386 AH. (Al-Muntazim, vol. 14 pg 377)
6. Building a structure over the grave of Sa’d b. Maaz in the second century. (Sair-o-Aalam-e-Nobala vol. 13 pg 285)
7. Embellishing the grave of Imam Bukhari – compiler of Sahih-e-Bukhari in 256 AH. (Al-Tabaqaat al-Shaafiyyah al-Kubra, vol. 2 pg 234)
8. Abbaside Emperor Haroon al-Rashid constructed a dome over the tomb of Ameerul Momineen (a.s.) during his reign in the second century. (Sair-o-Aalam-e-Nobala vol. 16 pg 251)
If leveling graves to the earth was ever mandated in Islam we can be certain that Haroon al-Rashid would definitely have done it given his animosity with the Ahle Bait (a.s.) of the Prophet (s.a.w.a.) and his role in the murder of the Prophet’s grandson – Imam Moosa b. Jafar al-Kazim (a.s.). On the contrary, we find that he has constructed a dome as a mark of respect for someone who he did not particularly love.
9. The respected companion of the Prophet (a.s.) – Hazrat Salman-e-Muhammadi (r.a.) passed away in 36 AH. Khateeb-e-Baghdadi writes about his tomb – His grave is present even today near the palace of Kasra in Madaaen, Iraq. It is well-known heritage site and has a structure over it. (Taarikh-e-Baghdadi, vol. 1 pg 163)
10. Regarding Talhah b. Abdullah – who died while fighting the caliph of his time, Ibne Batutah writes in his journal, “His grave is at the entrance of the city and over the grave is a dome and a mosque.” (Safarnaameh Ibn Batutah, vol. 1 pg 208)
When this is the respect accorded by the Muslims to the grave of a companion who died on falsehood, graves of those like the Imams of the Ahle Bait (a.s.) who were martyred on truth and were in fact Imams of truth, deserve even more embellishment, veneration and respect.
11. Muhammad b. Idris al-Shaafei – Imam Shaafei, one of the four jurists of the Sunni school, passed away in 204 AH. Zahabi writes, “The entire city collectively constructed a dome over his grave.” (Duwal al-Islam pg 344)