Using the historical-grammatical method, whether a text should be taken allegorically depends on the genre of the text. Usually, the author provides sufficient clues to the genre for us to accurately determine if a text is to be taken as something more than the surface meaning.
One of the challenges of interpreting the Bible is that it contains a diversity of genres. Each literary form conforms to its own unique set of rules. A personal letter, such as Titus, should be interpreted differently than a book of law, prophesy, historical narrative, poetry, or proverbs. To ignore the genre of a work is to ignore the author's intended framework of interpretation.
Things can get complicated when (as in the Gospels) several genres are used. Much of Mark, for instance, is historical narrative. But Jesus teaches in parable, discourse, apocalypse, and so on. Since the Bible often quotes or refers to itself (especially when Christian texts look back to the Tanakh), there can even be cases where a text is interpreted in ways that are essentially foreign to it's original genre.
But the author of the text almost always signals the genre of the text via textual clues. For instance, the presence of anthropomorphic animals puts the Three Little Pigs in the fairy tale genre. It shares an affinity with Aesop's Fables, but since most versions of the story lack a stated moral, it's a slightly different sub-genre. While we aren't always certain of the genre, we can usually reconstruct how the work was originally understood.
According to the conventions of some genres, images may be taken to mean something other than their surface meaning. For instance, fairy tales are usually assumed to have a meaning beyond the story itself. The Big Bad Wolf might represent all sorts of evil, including Satan and Hitler. The interpretation proposed in the question might be a bit extended compared to the usual interpretations of the three pigs story, but it does not seem to violate the author's intent. Note that the author could not have understood the tale as being about WWII, but that still is a legitimate reading within the genre. Other subversive readings, such as "the pigs to be attempting insurance fraud" would violate the metaphor established by the author.
So for genres designed to be interpreted metaphorically, a meaning beyond the surface meaning is not only permissible, but intended. But what about other literary forms, such as history, law, and letters? Is it legitimate to set up a metaphor, even an extended allegory, where the author didn't intend for it to exist?
Philosophically, any statement may have a contingent meaning in addition to its literal meaning. For instance, given the right context, "I've had a long day," could also mean:
- I didn't get enough sleep last night.
- I had a lot of work to do.
- I had very little work to do.
- I live in a northern latitude.
- I have an inflated view of my own self-worth and fail to see the difficulties faced by those around me.
In fact, there can be no limit to what a statement might mean depending on context. However, there is a limit the credibility contingent meaning carries based on the original text. Exactly where we draw the line is not a settled question, but that's the central task of hermeneutics.
God as author
What I've said above can be said about any text designed to carry meaning, but the Bible is different because it is also Scripture. For many people, that means that God is in some manner an author of the text. If so, every text may have a universal meaning far more extensive than other texts. For those of us who use the historical-grammatical method, every text has the potential to have a personal meaning that directly applies to our lives even if the human author never intended that meaning. For me, and many others, application of the biblical texts is the ultimate meaning and if it were not possible, I would not be interested in further study.