The Petrified condition (PHB p.291)
A petrified creature is transformed, along with any nonmagical object it is wearing or carrying, into a solid inanimate substance (usually stone).
Polymorph spell (PHB p. 266)
This spell transforms a creature that you can see within range into a new form.
The transformation lasts for the duration, or until the target drops to 0 hit points or dies.
The target’s gear melds into the new form.
The Polymorph has a specific list of conditions that ends the transformation it forces upon it's target. Applying the petrified condition to a target effected by Polymorph does not meet any of these conditions, either directly or indirectly, through it being a second transformation effect.
Even the "non-magical object it is wearing or carrying" clause in the petrification does not apply to any gear as it "melds into the new form" and is therefore not being "carried or worn".
So the simplest and easiest to run and understand option you list is the one that occurs:
- The creature is still in form B and is still petrified.
(evidence of some good game design going on)
If the petrification condition ends before the Polymorph spell ends then the target continues to be in the form dictated by the Polymorph spell.
If the Polypmorph effect ends before the Petrification condition ends, then the Polymorph transformation clearly ceases. However the petrification transformation effect does not. This can justifiably be interpreted in two ways by the DM:
- the petrified target changes back into it's original form while remaining petrified. I.e. the petrification transformation effect is strictly "into stone", it changes a "flesh and blood" form B into a "stone" form B, so when the effect causing the target to be in form B ends, it changes into a "stone" form A.
- the petrified target remains petrified in the second form until the petrification condition ends. I.e. the petrification transformation includes the form of the target, it changes a "flesh and blood form B" into a "stone form B" and so while it is in effect it remains a "stone form B".
I don't know of any RAW guidance to choose between these, but my own call would be 1. as it has the potential to be the most dramatic.