What is the purpose of the play being a play within a play? Now, before you all start making Inception jokes, there is a genuine purpose to this: one which proves that there may be more to the play than one might initially think.
The play is inside of another story, one in which the drunk, Christopher Sly, has a trick played on him by the lord of the local land. The lord, as a jest, decides to convince Sly that he is in fact the lord, and the play itself is performed to Christopher Sly and his "wife".
The "play-within-a-play" is unusual, as at first glance, it would appear that such is entirely unnecessary. In truth, it serves an alterior purpose: to remove the play from the audience by another degree. This serves to shift the blame a little farther from Shakespeare, should anybody get offended.
"But why would he put such a thing in," you may ask. "None of the men would get offended, this was Elizabethan Times." But, in truth, the play does not reflect the general idea of the time. Though women were though to be inferior to men, they were acknowledged as having the right to express their opinions. The reason the other characters in the play look at Petruchio so distastefully in many of his actions is for no reason other than that Shakespeare wanted to make Petruchio the bad guy.
In the end, this was not Shakespeare saying his opinion of a woman's place. Instead, it was a bit of a jab at the men of England, saying, "now wouldn't it be nice if the world was like this?"