HR has managed to grab the diversity / inclusion stuff at a lot of corporations which has given them newly found influence that they are not used to having and are overly-enjoying.
I will say they are a necessary bureaucracy in large organizations to make sure line managers aren't getting the company into compliance and labor law trouble. To a lesser extent they also help protect employees from really egregious mistreatment by poor managers who are managed by poor managers (sometimes it's hard to see what is really happening behind 2-3 layers of bad leadership.) I suppose that does fall within protecting the company.
Beyond that they really just get in the way, sometimes due to deliberate corporate governance decisions but mostly because they are bored and have an inflated sense of purpose of authority in organizations (and have turned into a dumping ground for bodies in order to meet diversity hiring metrics, particularly in technical organizations where women are substantially underrepresented in the labor pool.) I have had good HR managers and directors who viewed HR as a service organization and were fantastic partners...but they are few and far between. Individuals with P&L responsibility are much more effective when they, not HR, have more direct control over positions, grades, compensation, hiring/firing, and work/life policies.
Before I left the corporate world last year I was fortunate enough to end up at the right level in the company (a Fortune 50 type org) and within a group that was deemed critical to the growth strategy. We were able to grant our own exceptions to just about every HR policy (obviously not things like corporate wide retirement / benefits / insurance stuff) as long as we had legal sign-off. We completely bypassed HR for all of our position creation, comp grading, terminations, remote work, work schedules, etc. We were even able to grant unlimited vacation exceptions to our team, which was the backdoor way to move to an "untracked" PTO policy. HR absolutely hated it. We even completely cut out their talent acquisition / recruiting team, which seems to be one of HR's favorite roles because they usually get to sit in interviews and "consent" to hiring decisions and offers.
It made us as managers / leaders so much more effective at building the right team and we consistently had the highest employee satisfaction scores in the entire company and were also always #1 or #2 in meeting our corporate objectives (generally about 25% of the annual to-do list reported to the street fell to us.) I wonder why?

I will say I have no idea how that would play out at scale within a company that has 75k+ employees. I think it was probably highly dependent on good leadership with a ton of visibility and oversight from the c-suite. If we stepped out of line it would have been very obvious and HR wasn't needed as a hall monitor.