> optimize for the greater good
Greater good my posterior. The grandma was in the wrong place at that time because they optimised the experience to extract the most money out of the flying public. They were boarding the people who paid extra, and since she didn't they couldn't let her board. Because if they do why would anyone pay extra for their "higher class" more expensive tickets. They could have said "passport?" and then pointed her towards the gate. But doing so as a policy would net the corporation less profit. So they don't.
In other words the grandma's distress was by design. You can avoid the indignity of turned away from the gate by coughing up more money. She quite literally "didn't know her place" both in the queue and in the hierarchy.