There's a very ancient tradition where when someone dies, the relatives build a cairn of stones to protect the body. Every time someone comes to visit the grave, they add a stone. The more important the person (generally speaking) the bigger the pile of stones. The discrepancies would no doubt lead to cairn envy.
Perhaps some self-important personage decided to order his cairn built while he was alive, and the rest (as they say) is history.
That is a nice story and a good piece of history. But in the history of the world, the story does not fit with most Pyramids because the majority of Pyramids around the world were not tombs, cairns or the like.
They most likely had religious, spiritual ceremonial use more than anything. Also, the most significant ones were built with engineering and mathematical precision that has seldom ever been duplicated by any modern constructions.