Thus, there is no logic to it, other than that it prevents favouritism and binds the appointing authority to an objective criterion, never mind that it is based on time, rather than merit.
And without any logic other than the chronometer or the calendar, seniority has evolved into a nonsensical rule which must be discarded on the grounds that even though arbitrariness is inherent in all rules, in the seniority rule for appointing agents of the State is especially pernicious because it has a direct bearing on the efficiency and efficacy of public policy.
Or, as the Americans would say, it sucks!