"A Midsummer Night's Dream" was written specifically, or so it is believed, to be performed at a noble's wedding. It is a multilayered masterpiece that reflects love in all its many manifestations, something like a prism. It is a romantic comedy because it ends happily. It is wildly comic, but also deeply profound. It should not be dismissed as mere entertainment. The themes are love, passion, and relationship and all that they stir up when experienced by beings, human and otherwise.
Shakespeare did have a motif to write the play A Midsummer Night's Dream. He wrote the play to perform for the English royal family, as a way of comic relief from the depression seeming to be in abundance in the land. Usually, Shakespeare just writes to entertain his audiences, but in the case of A Midsummer Night's Dream, Shakespeare was writing for the royal family of England.
The key is in the summer delirium. These characters were intoxicated by the frivolity of summer. As a portrait of life the play is meaningless. As a snapshot of life's frivolity Shakespeare entertains his audience. I saw this play at Stratford-on-Avon Shakespeare theatre 15 years ago. Only recently has it's genius dawned on me.
He wrote this play just to provide some comic relief and laughter to the audience to savour. He imports several similar themes that he had used in other plays like "art vs life", "dreams vs reality" and "couple vs parents".
Shakespeare wrote his plays, especially his comedies, to entertain his audiences. Remember, writing plays (and acting in them sometimes) was his job. Shakespeare wrote this play using comedy, romance, fantasy, and a little bit of adventure so that there would be something that appealed to every audience member.