But assuming that's what parent was talking about (since that's the only thing they mentioned) - the market is sometimes wrong, for sure, but not as a general rule. If someone is earning a lot of money, they are giving some value that is worth it to the company that is paying them. More money = more value.
This doesn't always track with "contributions to society", because you can do things like e.g. stealing, which "gets you money" but doesn't contribute to society.
But consultancies as a general rule aren't stealing, they aren't as a general rule doing unethical things, etc. They are, for the most part, helping businesses. And that help is worth real money. This isn't theoretical either - if a consultant helps a business be more efficient in some process, that means real money to the company, which means real-world additional wealth is generated, which is a good thing.
The parent just made a quip because (I imagine) they think consultancies are a waste of money. And sometimes they are! But c'mon, I've known plenty of good, smart people working as consultants and I wouldn't want to jokingly quip that their job is meaningless. It's not worthy of a site like HN where we try to actually talk about things thoughtfully and critically.