My assumption is that these data are wanted in case you need to be warned about a possible infectuous person (Covid) being found later-by testing or whatever-in your train. I just read that in mainland China (which should not be the main example I would like to state) its even now done automatically by finding the mobile fone roaming data (as I heard in a recent radio program here lately). BTW": there are quite a lot of countries where the full name of the ticket holder is written on the ticket. Though on my last Turkey trip (some years ago by now) I was just named ''Mr. Tourist''. Giving these by some considered as very strictly personal data is considered quite differently in different countries.
For use IN the EU you get 2 codes: one for internal use, which is what daniel above here states, and also one more elaborate for INTERnational use, which also shows your name (to prove youre not cheating with someones else data), and at least the dates of the vaccinations-as some countries bar entry to those in the 2 weeks after, and in the period where the QR would already give a green tick. Newspprs here now make a big fuss about people advertising those yellow international vaccination booklets with your name on it-but without the proof that you have indeed been vaccinated.