Of course, not
all poor people were confined to the city. As you say, some came from a village where they still had relatives... who were not going to be very happy when a walking disease vector showed up from London and recent exposure to the Great Plague, even if he had a few pennies to contribute to his upkeep.
Many were, however, unable to leave because they had nowhere to go. Many came from families that had been in the city for generations and now had no contact with their ancestral villages. There was no Facebook or telephones, and poor people could usually neither write nor afford postage even if they could write. Moreover, families were frequently fractured. Unwanted children were simply turned out into the street, or they might wind up there when their parents died. They then had no clue who their relatives were or what village they'd come from.
Classical medieval serfdom had largely died out by the 17th century in England, but the villages were still often grindingly poor. There wasn't enough food to feed the (poor) people who lived there normally. Even during normal times, some penniless distant cousin showing up from London would often be despised as yet another mouth to feed (which is why they'd moved to the city in the first place.)
Many others just couldn't afford the trip. The sheer level of extreme poverty in which most Londoners lived at the time is hard to imagine for westerners today. Travel itself was expensive and dangerous during normal times, even for those who had some place to go. The plague made it more expensive and more dangerous.
For bottom-rung workers ekeing out a marginal sub-subsistence existence, for people who went hungry several days each week anyway during the best times, hiring a horse was out of the question. Their only option was to walk, perhaps for weeks, with whatever food and money they could carry. Poor people (read: almost everyone) had no access to banking services, so if they lost that money, they were screwed. (This wasn't a problem for most, as they didn't have any money to begin with.)
They not only faced highway robbery at every turn, but hostile peasants. No rural village was opening its arms to take in people who had just come directly from plague-ridden London. Such people were seen as dangerous threats, walking disease vectors likely to infect the whole town and kill everyone if they were not immediately driven off.
Wealthy people, by contrast, had horses, carriages, servants, guards, private food stores, and gated country estates.