It's just basic economics. An unsuccessful trainee costs a lot of money, and a successful trainee costs even more. Training, on average, lasts 3 years. Retirement age is 55. They are just making sure they are getting their money's worth and the new trainees are young enough to put in at least 30 years of service (well, to be very precise, 27 years of service).
Also, a younger applicant is less likely to have a family (therefore, less distractions during training) and more likely to have absolute freedom in moving away and dropping everything for training and the job. It's not discrimination - it's common sense.