If you read Pali suttas, you will see how Buddha says times and again, that people's opinion about a person are in large degree a reflection of person's virtue.
Basically, human ethics and Buddha-Dharma both stem from the same Reality or Truth of how things work, so naturally there is a large overlap. Things that are considered shameful by society are, for the most part, considered unskilful in Buddhism and vice-versa.
In the example of respect, the quality that is respected in society - such as consistency in applying one's (ethical) principles despite all kinds of distractions and pressure to the contrary, map to the quality of perseverance which is one of the Six Paramitas in Mahayana.
At the same time, since the end-goal of Buddhism differs from the end-goal of lay life, there are instances when the two systems disagree. In one of the (SN or AN) suttas Buddha said, it's easy enough to act skilfully when one gets approved by society, but only a wise person can uphold it when met with misunderstanding and blame. So clearly, Buddha was aware of the occasional conflict and insisted that in such cases the ethics of Dhamma must prevail.
Then, in Mahayana this is further analyzed in terms of the Two Truths: relative vs. absolute. From the perspective of the Absolute Truth, we clearly understand that the values of the relative truth are inherently pointless and purely conventional. So, for example, such a despicable act as cursing in public - is understood to be inherently empty - neither impure, nor pure. The ethical value of sounds is assigned entirely based on social convention. The sounds themselves are just that, sounds - and what may be offensive in one country could be a greeting in another.
Then again, from the perspective of the Relative Truth, our actions have real, objective effects. If someone is actually offended at our cursing, it is kinda pointless to argue whether the sounds have inherent meaning or not. The truth of the matter is, if you know that your acts will have certain effects, should you heed that or not? The answer is yes, of course.
Finally, from the perspective of the Unity of Two Truths, which is said to be the perspective of the enlightened mind, the conventional valuations existing on the relative level are understood to have grown from, or to have roots in, the Absolute Ground of All, so in that sense they are like shadows or echos of the truth, they are like reflections of The Law in pieces of broken mirror, not entirely valid, but not completely false either.
So, for example, respect in general, however conditional and superficial it may be, and regardless of the individual judgements made in all fairness or not, is still a reflection of something real that has an intrinsic value - the consistency of virtue, which is a reflection of the fundamental steadfastness and orderliness of Dharma ("Monks, whether or not there is the arising of Tathagatas, this property stands".)
In Tibetan Buddhism, especially in its most ancient Nyingma tradition, there is this deep respect for the wandering yogis famous for their complete and openly demonstrated disrespect for the social norms. In East Tibetan folklore there are numerous anecdotes about such yogis e.g. pissing in public and performing many other regrettable acts. The traditional moral of the stories is, the enlightened mind does not worry about the social morals, what it cares about is helping others progress on the Path, which is considered the higher virtue overriding the social norms.
At the same time, the fully enlightened mind of the Buddha is expected to be so infinitely skilfull, that its every single act is supposed to look valid and admirable from every possible point of view! Think about it, how cool is that? There may be infinitely many perspective on things in the universe and somehow Buddha is supposed to look perfect from every one of them. It's up to you to decide for yourself, whether you take this literally or as a didactic figure of speech, but the moral of the story for me is, the wiser and the more skilful we get, the less disagreement we generate with our acts - which kinda makes sense.
As for the ego question, of course Pride (in the sense of Conceit) arising from respect, and Self-Beating arising from Loss of Respect, are not the most healthy qualities of mind, according to Buddhism. Technically, both come from an idea of Self being valued high or low in the others' eyes. At the same time, on the lower levels of virtue, Pride and Self-Beating could be useful motivators stirring the sentient being towards a better path, so in this sense they can be useful to a certain degree. Check out "hiri and ottappa" for the traditional take on this.
So, to summarise this overly long answer, the social conventions such as Respect and Shame are inherently empty, partially valid and useful on the relative level, ultimately to be transcended for oneself on the path to liberation, can sometimes be overridden by the higher-level Dharmic concerns, but are nevertheless never neglected even by the fully enlightened Buddhas because of their effects on the unenlightened minds.