I have always subscribed to the Orion correlation theory of the pyramids, designed and placed to honor Orion, the star constellation, and the Great Pyramid had holes to sight the light from Betelgeuse.
But it is a theory and none of us were there.
There is plenty about the ancient world that we do not know and probably never will.
But I am going to go out on a limb here and say that is highly unlikely that Joseph built the pyramids to store grain for the famine described in the book of Genesis.