Some time after that they stacked the mastabas on top of each other forming a "step pyramid".
Eventually they would fill in the slopes to form the familiar pyramid shape.
Those like Pyramid of Djoser images may turn out to be newer than the ones at Giza, which in turn may turn out to be far older than thought by some hundreds of years - according to recent optical thermolumensce (when 2 pieces of stone were last joined) tests on the more recent of the three.
Those in the images are in the south of Egypt, while those at Giza are in the north which was ruled by “westerners” or “Libyans” until conquered by the southerners or Upper Egyptians long after the Giza structures were built. (which, BTW, seem to have been designed and built as one structure, and later re-purposed by the locals as was common in those times).
They may have indeed popped out of nowhere some 5-6,000 years ago, but likely their predecessors were long destroyed or are in inaccessible areas - filled with jihadis and such - west of Egypt to the coast in Mauritania. Even if some of these putative predecessors existed in some form up to relatively recent times when Mohammad’s Varsity pillaged the area in the 7th Century, they may have been totally destroyed, as the Varsity totally destroyed the vast gain farms and all other vegetation (using huge goat herds) turning the North African Coast into today’s semi-arid desert.