I get that some people are naturally nice and some others are not and find excuses not to be but all of cashiers in the supermarket I go to give you tired unconvincing robotic "Good morning/evening" and "Goodbye" and you can tell they are tired of it. Also they have to.
Would I be nice in a restaurant as a worker where people come to spend a special moment ? Yes, and I expect to be paid accordingly as it is part of my work. Serving people waiting in line in a fast food, will I be hostile ? No. Would I care about conversational etiquette serving people waiting in a fast food ? Hell no, I am not a smile delivery machine.
In the end it's all about stepping out of yourself and consider the reality the person in front of you is facing. Of course, if you've ever had to do a shitty job, that may help you.
Given long enough doing robotic work under what you seem unfair/dehumanizing conditions, the Slim Shady may come out. But who knows maybe you are a different breed, good for you.
E.g. Not getting enough sleep because your poor neighborhood is a ruckus provokes bad mood, chronically.
I've done hard labor (construction, landscaping), I've done food service (sandwich shop) and I've done lots of white collar office work. Wealthy people can be nice and decent to people who have a much smaller income AND vice versa.
At least waiters and strippers get tips for their show...