Comedy then is a result of learned (or ingrained) social cues which relieve stress in a group setting. I suppose it's upsetting when the laughs are at a group's expense. Laughing with somebody is better but that only happens when we can laugh at ourselves.