As Bloggs said, it protects pilots from
abuse, duress and intimidation in the form of holding back of commands and other unpleasant, unjustified consequences just because you don't suck up to the boss, buy his wife a drink at the company Christmas party or bend over and take it up the choof.
It also protects the airlines from large scale migration of pilots seeking greener pastures. Training costs for pilots are very high but the time needed to train a replacement is also a very significant factor. Airline managers understand this and the majority are happy to keep seniority in place and thus have a stable group of pilot employees.