In short, yes.
The rules in Section A (right of way) always apply, even when constrained by rules in Section B and C (which include room at marks). Boat A in your scenario is required to gybe at the mark. But let's look a little deeper at the scenario you describe, because it's a good question and it happens all the time.
At the zone, overlapped
A enters the zone overlapped with B, so Rule 18 (Mark-Room) turns on.
Rule 18.2 (Giving Mark-Room) says that:
When boats are overlapped the outside boat shall give the inside boat
mark-room...
so in this case B must give A mark-room. Since A and B are on opposite tacks, Rule 10 (On Opposite Tacks) still applies and B must keep clear of A (this may seem redundant, but it's not!).
In your first picture, A is sailing her proper course towards the mark. It looks like B is far enough away to be considered keeping clear--it would be easy for B to avoid contact with A at this point.
At the mark, overlapped
This position isn't drawn above, but it's basically halfway between your two sketches.
At this point, we have to look at how Rule 18.4 (Gybing) adds limitations on what A may do:
When an inside overlapped right-of-way boat must gybe at a mark to
sail her proper course, until she gybes she shall sail no farther from
the mark than needed to sail that course.
Since A would have to gybe to round the mark, Rules 18.4 applies, and A is required to gybe. This is the significant answer to your question.
Past the mark, overlapped
By your second sketch, both A and B have sailed past the mark. This is where your last question comes into play: does B only need to give enough room to round the mark?
It might be a bit surprising, but no!
Here, A has broken rule 18.4 by not gybing when her proper course to the mark is to gybe. However, B must continue to keep clear of A so long as Rule 10 (On Opposite Tacks) applies. Even though A is breaking rule 18.4 (and B should protest for that breach) the rules of Section A still apply. In your second sketch, B is getting quite close to A, and is possibly not keeping clear as required. If there is contact, B could be penalized, because B has broken a rule and does not enjoy the protections of Rule 21 (Exoneration).
In general, its in the best interest of the give-way boat to keep clear at all costs, and then protest for breaches for Sections B or C.
Citations:
https://www.sailing.org/tools/documents/20172020WorldSailingCaseBookv1.1-[22915].pdf
https://www.sailing.org/tools/documents/StudyVersionoftheRacingRulesfor20172020Final-[13380].pdf