It's a way of saying things that aren't supposed to be said. Whether the level of "supposed to" is a bit of moral outrage(like it is today), or a gulag(like it was in the Soviet Union), people use jokes to get around barriers. That serves the function of evading censorship sometimes, as well as the function of undermining certain kinds of groupthink to a certain extent. It's not perfect, but it serves a role.
And now we've switched from talking about the value of stereotypes in humor to the value of humor more generally. I agree with your statements about the value of humor more generally, and am otherwise tapping out here.
As Multiheaded added, "Personal is Political" stuff like gender relations, etc also may belong here.