Logically speaking, yes, the cathedrals don’t provide goods and services (in this case, shelter and storage) that are commensurate with their cost. A productive society
in theory has no need of them. But we humans are emotional and irrational, and sometimes you need the grandiose and the absurd to motivate us to greatness - there’s just no getting around that.
Similarly, I’d prefer a world without nail salons - logically speaking. To me, they’re pointless and stupidly wasteful, and here in California they’re everywhere. Yet thousands if not millions of people love to have their nails done. It makes them happy and gives them joy in a world that all too often shows its claws. So even if I had the power to banish them, I wouldn’t. I genuinely believe they make the world a better and more productive place. Just like cathedrals.