to pray facing the graves of prophets or righteous men out of a desire for blessing or to exalt them, and likewise to pray directly upon the grave for the same reasons. That such conduct is a major sin is plain from the aforementioned ḥadiths, as you have already learned.
Some Hanbalī scholars have said:
“Deliberately setting out to pray by a grave in order to seek its blessing is open defiance of Allah and His Messenger and an invention in the religion for which Allah has given no permission. The prohibition of this has the consensus of the scholars. Indeed, among the gravest of the forbidden acts and the strongest causes of polytheism are performing prayer at graves, turning them into mosques, or building structures over them. Any statement that it is merely ‘disliked’ must refer to something else, for it is unthinkable that scholars would permit an act whose perpetrator the Prophet ﷺ repeatedly and reliably cursed. One must hasten to demolish such mosques and the domes erected over graves, for they are more harmful than the Mosque of Dissension, having been founded upon disobedience to the Messenger of Allah ﷺ. He forbade this practice and commanded that elevated graves be levelled. Every lantern or lamp placed on a grave must be removed, and any endowment or vow made for that purpose is invalid.” End quote.
All of the above is the statement of the jurist Ibn Ḥajar al-Haytamī, and it was endorsed by the scholar al-Alūsī in Rūḥ al-Maʿānī 5/31. This passage shows