I would actually argue that the mechanicals are very essential to the development of the play and its most critical theme, reality vs. illusion. Shakespeare is pointing out in this play that there is a very thin line separating reality from illusion and that, actually, our illusions or fantasies govern or shape our reality. All throughout the play, the main characters have their own realities manipulated for them. The mechanicals are the only characters who show us that human beings can actually allow their own fantasies or illusions to manipulate their own realities.
In A Midsummer Night's Dream, both Puck and Oberon manipulate the realities of the four Athenian lovers in the woods, as well as Bottom. Puck especially manipulates reality by enchanting both Lysander and Demetrius to fall in love with Helena while before they were both in love with Hermia. Puck claims that this manipulation was merely a mistake on his part and unintentional because he had no idea there were actually two Athenian couples in the woods that night, as we see in his lines:
Believe me, king of shadows, I mistook.
Did not you tell me I should know the man
By the Athenian garments he had on? (III.ii.363-365)
In contrast, the mechanicals have their own illusion of putting on a grand performance before the duke in honor of his wedding day. However, the reality is that the mechanicals are too poorly educated and too unskilled to be able to put on a well-performed production all on their own. We see examples of their lack of education and skill when we see them come up with ridiculous solutions to their set design problems, such as having an actor play the part of a wall and the moon, instead of designing a movable set. We especially see examples of their lack of education when we see them mix up words, such as the line Bottom delivers during rehearsal, "Thisbe, the flowers of odious savors sweet--" (III.i.75). Since it does not make sense to relate Thisbe to "odious" flowers, which would mean repulsive flowers, it is evident that Bottom actually meant to say "odors."
Since the mechanicals are too unskilled to perform the quality of play they envision in their fantasies but perform it regardless, they receive a great deal of laughs and criticism from their audience. Since they allowed their fantasies of reality to dominate actual reality, we can say that they allowed their illusions to manipulate their true reality, making themselves look rather foolish, which serves to illustrate one of Shakespeare's central themes, reality vs. illusion.