These huge stone edifices were most often built for two purposes. To honor the King for some exploit or other; and to overawe the poor folks and keep them in their places.
It’s amazing what you can build with unlimited power and wealth and a goodly supply of slaves. I may be a more skeptical view, but it is one that seems to come across after visiting so many of them and thinking about how and when they were built.