Underpaid is an interesting term, I guess. When you think about it, software (in its many forms) isn't like retail or hard goods; it can be sold - usually - an infinite amount of times. The upside is massive since all hard overhead is eliminated. Where then should that overhead go? To management?
It's all about ratios, of course. If the owners/management of a company are grossly overpaid in comparison to the workers who produce - especially if physical overhead is nearly eliminated - then yes, developers are indeed underpaid. And I would posit this is true in many areas of software development. Perhaps not your situation, but overall? I buy it.
I will admit that my situation may be more unique than I realize. After all, there are vastly more software companies out there than I could ever work at, so my own experiences can never be more than mere anecdata, no matter how much I'd like to extrapolate from them. And I've only ever worked at small companies, so a relatively tiny number of developers have also worked at the same places as me. This is in stark contrast to huge corporations like Google and Amazon, where I could at least extrapolate my experience to thousands of other employees at the same company.
I have not had the sense at my own jobs that the upper management was overcompensated. I can't prove this of course as I didn't and don't have access to the company's financial statements and bank accounts, but the norm has seemed to be to reinvest profits in the company in order to remain competitive. It's worth pointing out that I've only (so far) worked at companies that have been self-sustained, not requiring any VC funding. My impression is that many bootstrapped software companies are not actually making that much money; revenue figures in the $10M-$20M range are not uncommon. This money is easily spent on a staff of 50+, office space, etc.
It's all about ratios, of course. If the owners/management of a company are grossly overpaid in comparison to the workers who produce - especially if physical overhead is nearly eliminated - then yes, developers are indeed underpaid. And I would posit this is true in many areas of software development. Perhaps not your situation, but overall? I buy it.