The need for grain storage is at least as old as agriculture. The pyramid is an ancient architectural form, predating the Great Pyramids of Egypt — it seems entirely possible that it had utilitarian uses, long before it was used for tombs and monuments.
Actually Pharaoh Tutenheadake`s son, Prince Tutencoma, invented the GRAIN ELEVATOR for bringing the grain up under the great Pyramid, where it would be easily crushed to flour by its massive weight. The pyramids are actually gigantic flour mills.