- The second pigeon flew…
This is the simple past.
We also learn a previous pigeon had performed the same action earlier.
- …just as the first pigeon had flown.
This is the past perfect tense.
The original sentence could remain as it is, but a good writer will probably sense that writing the term pigeon, or repeating the same verb fly twice is redundant. In order to overcome this, a pronoun is needed to substitute “pigeon”.
- …just as the first one had flown.
Now, I quite like this version but it is not included in the multiple choice. The closest equivalent is C) …one had flown away. The adverb away, in this context, means “further from a place, thing or person”, and “fly away” is a very common collocation. So, the OP could choose C).
- C) …just as the first one had flown away
If the writer wanted to use a pronoun, and avoid repeating the same verb, the auxiliary verb, do, is used.
- B) The second pigeon flew just as the first one had done
Here, the adverb away is not mentioned at all, if had been added to the first clause, then the second clause would fit perfectly,e.g. “The second pigeon flew away just as the first one had done.”
There is the construction do + so, where different forms of do so substitutes the verb, and its complement. e.g. a) The second pigeon returned to its coop just as the first one had done so. b) They asked me to revise the essay and I did so (= I revised the essay.) c) Dangerous currents. Anyone who swims here does so at their own peril. In the OP's example there is no complement in The first pigeon flew and therefore "so" is not required.
For more information about Do as a substitute verb, visit the Cambridge Dictionary Grammar website.
D) is incorrect because a noun or pronoun is missing:
- D)…just as the first had done
The first what? It might be a white dove, or a duck for all we know.
So all this boils down to personal preference, and style. There is nothing grammatically incorrect with clauses B) or C), either one, in my opinion, is appropriate.