You’re in church. Or a library. Or at a funeral. Someone sitting next to you makes a funny noise, or cracks a joke under his breath. You start giggling/snickering uncontrollably. You know you’re supposed to be quiet in this place, but that only seems to aggravate the problem. For the life of you, you can’t stop snickering.
Why? What is it about knowing that you’re supposed to be quiet that makes it even harder to stop giggling?
One would think that this trait would be counter-evolutionary. Picture two australopithecines (call them Thag and Onkk) on the African savannah. A leopard is nearby. Thag and Onkk try to remain absolutely still and quiet. Suddenly, Thag thinks a primitive (but still very funny) thought, and starts snickering uncontrollably. Onkk is mortified. The leopard pounces, and the uncontrollable-snickering-gene is summarily eliminated. One would think.
The leopard would probably not hunt australopithecines.
Thag and Onkk would not be hiding close to the leopard — THAT would be almost certainly betray their precense because the leopard has a good sense of smell. They would probably escape at the first sign of a leopard. However, see #2
Ha ha ha ha ha ha!— ahem! Excuse me.
You are assuming that just because Thag is dead, the gene won’t be passed on. If #1 is true the gene is passed on, especially if Onkk had less children over his lifetime than Thag.
This particular aspect of humor is not passed on genetically directly. It is more of your personality and how you regard the occasion that decides your response.