The age of Dryden marks the beginning of Restoration in England. That is a period where all three monarchies were reunited under one rule, that of Charles II.
The purpose that the historical anecdotes serve in these two literary pieces of art is that they serve as attention-grabbing hooks. They need to get you interested and involved in the story.