HR represents the company. Where your goals and the company's aligns, they can be helpful. Where they diverge, perhaps less so. I think a lot of these sorts of articles discount the idea that your goals and the company's will frequently align. For example, if you're being harassed, it's very often in the company's interest to stop that happening. It will cause you and perhaps more people to quit if they don't, and th…
You’d think so, but (as you go on to mention) all too often that interest is mediated through some proxy metric such as legal or publicity risk, which can entail a reaction contrary to your interest: e.g. legal risk might reasonably be thought proportional to your legal budget, which is related to your position in the company, so low-level employees get ignored; or if it’s easy for everybody to get publicity, maybe suspects get fired no matter how slim the evidence (the company is free not to do business, including employment, with whomever they want!), making real claims look less legitimate because a few fake ones are widely known; or legal and publicity risks get mitigated by paying everyone involved to shut up rather than solving the problem; etc.
So far it doesn’t look like proxy metrics imposed by government or popular opinion work all that well.