The Great Pyramid of Giza was constructed about 2580–2560 BC.
2500 years have passed.
Cleopatra lived 69-30 BC.
2000 more years have passed.
The first man landed on the Moon.
The practice of constructing pyramids was discontinued long before Cleopatra—about 2000-1600 BC. So why do we think that Cleopatra lived in the pyramid-building times?
The most common and superficially satisfying answer is that it served as a huge "Loot here" sign for robbers. Grave robberies were a huge concern throughout human history. This answer is not very plausible though. Pyramids had been in use for a thousand years and it's hard to imagine that for a thousand years wise pharaohs, priests and builders didn't realize that all the pyramids were usually robbed within a century from being built.
The more likely reason is that a sense of power shifted in religion. Pyramids were the largest expressions of a single person's power in human history. When the perception of god got stronger, there was a shift in monumental buildings too: more huge temples for gods at the expense of pyramids for pharaohs.