Shit, HR doesn't even exist to protect the company sometimes. Sometimes they get so cancerous that they start to operate as if the company works for them.
Hence my megacorp's most recent CEO fired the CPO, and hired a long time former company employee with no HR background to go clean house of the infestation of Vice-Vice-Vice-Vice-Vice-Vice-Vice-Vice Presidents in HR.
I have just experienced this.They raised HR exec up to VP level so they could investigate another VP to ultimately fire them.
Then once the BAD VP was fired the owner fired the HR VP and the the replacement was not a VP.
DirtyDeeds.DoneDirtCheap.
Ultimately it's the board of directors' call. Sometimes they are oblivious to how much HR undermines the company by bringing in unnecessary distractions and making poor hiring decisions. Like much else, it's subject to momentum.