In my view, people’s behaviour in boarding is not quite so irrational.
On a long train where access to the platform is at one end only, people are aware that it takes a certain amount of time to reach the other end (and most people unfamiliar with train configurations will not be too sure exactly how far they’ll have to go). Since the gate line will act as a pinch point, you will be further delayed in beginning that walk, and then held back by all the people in front of you, meaning that unless you can dodge round people, wheelie suitcases (mobile trip hazards), dogs, bikes, pushchairs etc you are going to be moving at the pace of the slowest in the crowd (probably the person looking up the details of their carriage on their mobile). This not unnaturally makes people anxious about finding their carriage in time, and desirous of being at the head of the pack.
In addition, for those travelling with luggage, many will have experienced the situation in which their bag or case does not fit into a poorly designed overhead rack, and the baggage space at the end of the carriage is wholly inadequate. Under the circumstances it would not be surprising if people were anxious to grab some of that luggage space before it all goes.