We're talking about two different things. Yes, a school like Harvard pays top dollar for a full professor that they really want. Those positions are not underpaid. Harvard will outbid Ohio State and anyone else for the cream of the crop. But when it comes to untenured assistant professors, Harvard absolutely does underpay, and so does every other elite math department. For example,
BPs at Harvard make $60600 per year. That's low even compared to the national average, never mind compared to what you would expect at a top institution.
Continuing with the Harvard theme, if you google Benjamin Pierce assistant professor, the first page of Google results links to the following former BPs: Lauren Williams, Pavel Etingof, Danny Calegari, Nathan Dunfield, and Xinwen Zhu. These people, obviously, landed on their feet and got hired in other universities, quite prestigious universities in fact. And I am sure if you did a comprehensive survey of all former BPs, you'd find the majority working in R1 universities and on the tenure-track. Similar remarks would apply to the untenured named instructorships at any other elite math department, e.g. Dickson Instructor, C.L.E. Moore Instructor, Veblen Research Instructorship, and so on. They're all slightly underpaid. They're all hugely prestigious. And few people have trouble landing a job afterwards.
If you get denied tenure at a lower-ranked school, then yes, that is a disaster. Those schools are set up to give you every opportunity to pass the tenure review. If you fail to do so, then that's on you, and as you say, you'll be an outcast.