

that is a very weird way of looking at it. “thank you” has always been a way of expressing gratitude.
yes, they may simply just be doing their job, but at the same time you are also doing what you as a customer should be doing: place your items on the counter, pay, get your stuff, and leave. there’s no need for you to thank someone; there’s no need for any words of exchange.
“thank you” may be a standard polite phrase, but so is “you’re welcome” or “no problem”. you were polite to them, so let them be polite to you by acknowledging your expression of gratitude.

You expressed gratitude. You may not have meant it, but you’ve expressed it nonetheless. It doesn’t matter if the opposite party deserved it or not; “thank you” is an expression of gratitude, and the only polite ways they have of answering that is “you’re welcome” or “no problem”.