So Allah knows best. What appears most probable is that the people who made that statement were those in power and authority. Yet whether they deserve praise is open to question, for the Prophet ﷺ said, “May Allah curse the Jews and the Christians; they turned the graves of their prophets into places of worship,” warning against what they had done. We have also transmitted that when ʿUmar ibn al-Khaṭṭāb discovered the grave of Daniel during his time in Iraq, he ordered that it be concealed from the people and that the parchment found with him—containing reports of future events and the like—be buried.
Once this is understood, the verse cannot be cited as evidence under any circumstance. The meticulous scholar al-Ālūsī said in Rūḥ al-Maʿānī (5/31):
“Some have used the verse to permit building over the graves of scholars, erecting a mosque upon them, and performing prayer there! Among those who mentioned this is al-Shihāb al-Khafājī in his glosses on al-Bayḍāwī. This opinion is utterly false, devoid of proof, unsound and valueless, for it has been reported …”
He then quoted several of the aforementioned hadiths and followed them with the words of al-Haytamī.