If the TD occurred in the 4th quarter, the try is always part of the 4th quarter. In your play, A has three options: decline the penalty and take the result of the play (successful try); accept the penalty, half the distance, and retry (dumb); accept the penalty and enforce it from the succeeding spot (OT, whether A ends up on offense or defense).
You've already cited the correct rule.