IIRC, their society depended on it. During peacetime, it was a major economic engine paid for from the royal treasury, with the work starting as soon as a new pharaoh ascended the throne, and the labor provided steady work when agricultural activity stopped due to Nile flooding. Of course, it's only in hindsight with our modern understanding of economics that we can see how such an activity at face value not important to any basic survival need was in fact a key piece of the economic fabric.