LIFO is not illegal, however, if it leads to discrimination against a particular group i.e. young pilots, that's when it becomes an issue - on the basis of discrimination.
I agree, recent joiners are very likely to be young, which in itself is probably the result of age-discriminatory criteria in selection for these junior boys and girls on the mentored/part sponsored courses in the first place. Funny old world!