A written work, whether it is a short essay, or a novel, a song, or a text book, can indeed serve multiple purposes. Many of the best ones do.
Writing teachers often advise planning for a single purpose, because that is easier and helps a budding writer retain focus. Teaching a young writer to plan at all is hard enough, teaching how to plan for multiple effects is much harder. Planning a work can help avoid a confused work that goes nowhere. But some of the most acclaimed authors did little if any planning. Mark Twain, for example, seems to have done little or no planning for much of his fiction, and many of his shorter humorous essays. In some cases this resulted in works that seem unfinished or awkward, such as "A Double-Barreled Detective Story" or the several unfinished and unpublished versions of The Mysterious Stranger. But on the whole, his methods seemed to work well for him.
Satirical works, in particular, often serve multiple purposes. Consider the first section of Gulliver's Travels, separately titled A Voyage to Lilliput. This served, in its day, as a sharp satire of then-current politics. It also served as a thrilling adventure story. And it has been taken later as a general advocacy of equality.
This can also be true of non-fictional works, such as essays. Many of Issac Asimov's essays served both to educate people about particular facts, and to advocate for a pro-science view of things in general. Stephan Jay Gould's famous essay "Human Equality is a Contingent Fact of Evolution" serves both to discuss in some detail certain aspects of how evolution works, and to make several ethical points. Both meanings seem very clearly intended and planned for.
Poetry often has multiple meanings on multiple levels. Kipling';s well-known verse "Gunga-Din" both depicts some of the attitudes of the British soldier of its time, and makes a moral point about the equality or more exactly the equal moral worth of people from different racial groups. Much the same could be said of his less known verse "The Mother Lodge"
There is nothing wrong with having multiple meanings in a single piece of writing. However, it is harder to do well than having a single focused purpose, particularly in a short essay. One will want to avoid having the meanings result in a confusing and unclear piece of writing, or even having them clash. If the work can be clearly focused on more than one goal, wonderful. But often having only one goal at a time makes that goal easier to reach.