(the other option of course, as people say above, is to regard this unusual event as more like a special case of 'held up' and to give an attacking 5m scrum)
The question boils down to this:
22.10 BALL HELD UP IN-GOAL
When a player carrying the ball is held up in the in-goal so that the player cannot ground the ball, the ball is dead.
A 5-metre scrum is formed. This would apply if play similar to a maul takes place in in-goal. The attacking team throws in the ball.
22.11 BALL DEAD IN IN-GOAL
(a) (deleted for clarity)
(b) When a player carrying the ball touches the touch-in-goal line, the dead ball line, or touches the ground beyond those lines, the ball becomes dead. If the ball was carried into in-goal by the attacking team, a drop-out shall be awarded to the defending team. If the ball was carried into in-goal by the defending team, a 5-metre scrum shall be awarded and the
attacking team throws in the ball.
Does 22.11(b) override 22.10?
22.10 specifies a player in the grasp of an opponent (deduced from "held up") but 22.11(b) makes no mention of it.
My conclusion is that 22.10 only applies to a player who is "held up in goal" (as the heading states) and not driven out of goal.
Therefore a maul driven TiG or over the dead ball line comes under 22.11(b) unless the referee deems it falls under 22.10 due to time or no resolution.