I found the following quote on another site:

HISTORY OF GUMBAD-E-KHIZRA

After having read the above tradition there arises in some minds the question that if this tradition calls for the above then how the dome"Gumbad-e-Khizra" came into existance on the grave of the Prophet صلي الله عليه و سلم Its answer is that there built no building on the Prophet (s.a.w)'s grave for about seven hundred years. Then in 678 AH Egyptian Ruler Mansur bin Qalawun Swalehi, in consultation with Kemal Ahmed bin Burhan Abdul Qawi, got prepared a wooden railing and affixed it on the roof of the romm [wherein the prophet (s.a.w) was burried] which earned the name of "Qubba-tur-Razzaq". The contemporary scholars could not refrain that influential ruler but they disapproved this task very much. And when kemal Ahmed, who had so advised, was dismissed, people held his dismissal as the requital, from Allah , of his above deed. Then-Al-Malik-un-Nasir Hasan bin Muhammad Qalawun made some additions and thereafter in 765 AH Al-Malik-ul-Ashraf Shaban bin Hosein bin Muhammad added further construction till the present form came into being [Wafa-u-ul-Wafa by Samhudi vol.1 pp. 435-436]
My question is, if this is true why would the Gumbad-E-Khizra be so respected if it truly was wrong for it to be there in the first place? If building structures over graves is wrong, the Masjid-un-Nabawi being expanded over the grave of the Prophet would be wrong as well, wouldn't it? Is it true that it would be obligatory to remove it? Many do say so.