The adage is meant to warn against betraying one's values or beliefs for the intent of fitting in. To believe that one should not be themselves is to ascribe to the belief that the collective "norm" is more valuable than the individual or the self, which is dangerous, self-defeating, and can lead to uncomfortable dissonance. The adage also encourages expression, creativity, and honesty, which are all net benefits.
Being yourself just means being true to who you really are, what you really value, it does not mean you don't examine yourself. It does not mean you refuse criticism or refuse to criticize yourself.
Even if the person seems terrible the only way they are not going to be terrible anymore is if they get in touch with the good aspects of themselves and promote those and see how their terrible aspects conflict with those. Otherwise they are just pretending and eventually they will no longer want to keep up the facade or will revert to their terribleness any time they can get away with it.
"Not being yourself" is NOT a solution to anybody's problems. Working through life to become more of one's higher self is the solution.
For example, I could possibly say that I am a popular, young girl. I do not, however, pretend to be less intelligent than I am in order to attract potential boyfriends or girlfriends. I also play League of Legends, despite the stereotypical 'female' or 'popular girl' image, who would be interested and involved in 'feminine' activities such as cheer leading, painting my nails, or anything of that nature. I make friends that are true instead of ones that enjoy being around someone who is not truly myself. I don't use this phrase to justify any of my negative behaviors, I'm constantly trying to improve myself, but for the sake of my own success, not to please other people.
I think "be yourself" is the antithesis of self-improvement. I don't want to be myself, I want to be better than I am. While it's sort of a nice thing to tell people, nobody really means it. If yourself is a horrible person, people are going to tell you to change. When people say "be yourself", it really means "be a collection of traits deemed appropriate by society while having some semblance of self."