I think ”be yourself” is a bad advice. It's ok to accept yourself as who you are, you don't have to change that. I also agree that you should behave the way you do without acting some other role because of others.
I'm comfortable being myself. I like who I am. But there are things I want to change. It's not who I want to be but what I would be at my best.
For example all those social situations. The twisted introvert inside me screams: leave, or at least don't say anything! But that's not who I want to be. So I stay, I talk. I pretend to be social.
If I want to be something else and act like that is it pretending? Like not being myself in those situation because that's not how I would act in those situations. If I keep doing that I will eventually start acting that way naturally, I can be myself in those situations. Fake it till you make it. But you have to mean it.
Don't settle being yourself, try to become the best version yourself instead.