A Midsummer Night's Dream is a comedy, so it's going to have its fair share of slapstick humor. It's obviously funny to watch a man with a donkey's head wander around on stage, but it's a different kind of humor than when Egeus gets absurdly mad at his daughter and decides to have her killed. Really, it all ends up being two sides of the same coin – nothing, not even murder and death, is taken seriously here. Misunderstanding is as central to the play as any other element of plot. Finally, as the play is really about love, you can't avoid embarrassing foolishness. We all know that.
When Shakespeare makes fun of the Mechanicals, he's making fun of uneducated commoners.
The silliness of the Mechanicals isn't meant to degrade those characters or their social status. In fact, Shakespeare pursues a far more egalitarian course: the folly of the Mechanicals – confused, misled, and misunderstood by each other – matches exactly that of the young Athenian lovers lost in the wood.