Yes, this is age discrimination. But not all forms of discrimination, and in particular age discrimination, are unlawful. With reference to age discrimination, if the discrimination is a "proportionate means of achieving a legitimate aim", it is not unlawful, as per
Section 13(2) of the Equality Act 2010.
Having Railcards that make rail travel more affordable for certain, typically less well off, parts of society is likely to be a legitimate aim - certainly in view of the fact that the TOCs will be under a legal obligation, thanks to
Section 28(3) of the Railways Act 1993, to participate in a discount scheme for the "young, elderly or disabled".
Discriminating on the basis of gender or race is not permissible on the grounds of it being a proportionate means of achieving a legitimate aim, and in any case it would be a lot harder to establish the legitimate aim.
As to whether it ought to be unlawful, if you think the exemption above should be scrapped, speak to your MP about it! (Not that I think it is likely to have any chance at all of gaining traction with the current political situation.)
In any case, scrapping this exemption would, for example, mean that everyone, no matter their age, would have to pay the same for car insurance (with it being adjusted solely by factors such as where they live and what car they drive). I'm sure older drivers would not be happy with the resultant massive increase in premiums!
Now, of course, there are those who support plans for a National Railcard that is available to all ages, and indeed such a concept exists in many other countries. Nevertheless, the vast majority of countries having such a scheme still do discriminate between different segments of society, at the very least in terms of the price and/or discount offered by the Railcard equivalent product.