The 16-25 railcard has evolved from the student railcard that was created in a deal between British Rail and the National Union of Students - this is a commercial product, not a state-benefit. Prior the 1980s, the product was only available to students, not all young people, so in part mature student access is a legacy of that.
Labour market statistics show that graduates earn on average (though of course there is a lot of variation!) £10,500 more a year than non-grads, and people with postgrad qualifications earn on average £6,000 more a year again. So commercially, it makes sense giving a discount to get these people using the train when they're on a lower income.
With regards to people not working because of illness who are not on benefits: no, I suppose people don't get a discount. You can blame a government that has systemically dissembled the welfare state so that people who might require financial support don't receive it, because of misguided beliefs about the nature of labour, healthcare, psychology and economics, for that.