it seems that Bob was in her flashback.
No he wasn't. Bob had already been arrested and killed himself by the time Joy escaped.
So did he help her escape?
No he didn't.
Instead, Joy and Anna somehow manage to sneak out of the back door of the house.
(We are not shown how exactly. We are merely shown them walking along a wall in the house and towards a door. Given that the flashback shows bottles of the drug, one possibility is that Holly Jones thought she had them thoroughly drugged but made a mistake with the dose.)
However, while Joy gets away, Anna is caught by someone whose back we see:
This someone grabbing Anna must be Holly Jones. It can't be Bob Taylor because Bob had already been arrested and killed himself by this time.
The height also matches. The person grabbing Anna is not much taller than Anna.
Keller (Hugh Jackman) next to Anna:
Keller next to Holly Jones:
Joy manages to run all the way to a road where she is picked up by a passerby as she's running across a road: