Taking graves as mosques is forbidden
➊ In a narration from Aisha (may Allah be pleased with her):
لعن الله اليهود والنصارى اتخذوا قبور أنبيائهم مساجد
“May Allah curse the Jews and the Christians; they took the graves of their prophets as mosques.”
➋ In a narration from Abu Hurairah (may Allah be pleased with him), the words are:
قاتل الله اليهود
“May Allah fight the Jews.”
➌ In one narration, the Messenger of Allah ﷺ said about the Christians:
أولئك إذا مات فيهم الرجل الصالح بنوا على قبره مسجدا أولئك شرار الخلق عند الله
“When a righteous man dies among them, they build a mosque over his grave. They are the worst of creation in the sight of Allah.”
➍ It is narrated from Ibn Mas’ud (may Allah be pleased with him) that the Messenger of Allah ﷺ said:
إن من شرار الناس من تدركه الساعة وهم أحياء ومن يتخذ القبور مساجد
“Indeed, among the worst of people are those who will be alive when the Hour is established upon them, and those who take graves as mosques.”
(Ibn Hajar al-Haytami, may Allah have mercy on him) Taking graves as mosques is a major sin.
(Albani, may Allah have mercy on him) Doing so is forbidden. Furthermore, taking graves as mosques includes three matters:
➊ Praying facing the graves.
➋ Prostrating upon the graves.
➌ Building mosques over the graves.
For further detail, it is beneficial to study Sheikh Albani’s (may Allah have mercy on him) book تحذير الساجد من اتخاذ القبور مساجد.