If a creature gains flanking during combat, that has no effect on any creature already blocking it. A creature needs to already have flanking before blockers are declared in order for its flanking ability to trigger.