There’s always a ritual quality to the public side of apparel. When one puts on a suit and tie to go to the symphony, for example, one is making a statement about the seriousness of the occasion. Wearing a tailcoat won’t make the conductor do a better job, but it’s a way of saying “we’re all here for something important to us all, so let’s all pay attention.” In another culture that message might be communicated quite differently, but there would be established ways to communicate it.
Similarly for going to a fine restaurant. Both, as you say, as a token of respect for the restaurant, but also for the effect it has on focusing the mind.
Edit: This was following up on Claghorn's immediately prior post. Should've quoted. Sorry.