Good question. "Pyramus and Thisbe" is usually looked at by critics these days as a parody of "Romeo and Juliet", a play usually considered to be from around the same sort of period in Shakespeare's writing. It's possible that the two plays appeared "back to back" at the Globe, in repetoire.
And that, I think, is part of its job: locating a little tragedy of love (in which two lovers end up dead through mistaking...) within a comedy. It reminds us, of course, that even love in the comedies is painful and can lead to extreme emotions (you only have to think of Bottom-as-donkey sleeping with Titania, or the lovers' bloodthirsty fighting in Act 4!).
Love and death - "death" to the Elizabethans didn't just mean "the point at which you aren't alive", but also "orgasm" - were closely linked in the Elizabethan age, and Shakespeare (here, and in "Romeo and Juliet") is keen to juxtapose sex, death, and love.
On another note entirely, the other key point about the play-within-the-play is the theme of transformation. Bottom and Flute "become" Pyramus and Thisbe just as Bottom early became a donkey, just as Theseus and Hippolyta (in many productions, anyway) double up to "become" Oberon and Titania. Things change, and transform - love becomes hate, and hate love. Puck shifts shape into stools and mugs to trick the mortals. Everything changes.