Hah, a thing I was just reading about! The answer is "yes and no"-or at any rate that a number of legends fitting them into an Islamic historical framework emerged. A lot of these legends are cataloged int the Mameluk historian Maqrizi's al-khitat. I will summarize the general gist of them, since most of them follow a fairly similar pattern:
In the usual telling, Egypt exists before the great flood as a land of ancient civilization and hidden lore(a theme common even in Hellenistic accounts of Egypt). At some point, a king either becomes forewarned of the flood thanks to the secret wisdom of the Egyptians or simply decides upon the need to build a storehouse for his treasures. In the former case, this king is often called Hermes or Surid. Many of the accounts then describe a specific scheme for the hiding of treasures-one chamber being devoted to rich jewels(one story recounted even describes discovering an enormous emerald in the pyramids), one chamber being devoted to astronomical texts and holding the bodies of priests, and so on. The pyramids are then sealed and survive the flood as a repository of ancient knowledge. In other tellings where the flood motif is omitted, a statue and inscription describing the difficulty of building a pyramid and cursing looters and destroyers might be described. A few myths even described them as the burial-places of kings. In all of these, they are repositories of fabulous treasures and in some cases the treasures are described as being discovered in recent memory, with some accounts even describing them as being displayed in the Fatimid royal palace. Now of course most of these accounts are not based on familiarity with Egyptian literature and some are probably exaggerated or untrue(I am not sure for example if any Pharonic articles entered the Fatimid royal collections) but this gives a good idea of what medieval Egyptians thought of the pyramids-that they were stores of fabulous treasures by ancient kings-and that they attempted to understand their purpose in the context of Islamic and Greco-Roman beliefs about the past.
/u/farquier gave a great account of al-Marqizi's contributions to Egyptology, but there is also Abdalatif al-Baghdadi. Abdallatif was a 12th & 13th century Islamic scholar from Baghdad who wrote some of the earlier accounts of Islamic Egyptology.
While Islam considers the age before Muhammad the age of ignorance, much of Islamic scholarship saw the past as an important aspect of life. They studied the ancients to learn from them, study humanity's development & their spirit, and use as evidence to support the Qur'an and its teaches. Abdalatif supports these suppositions in his Account of Egypt.
Was anyone still worshiping Ra and Horus and them by the time Islam came around?