That’s a good use of VAR, probably about the only one.It is for VAR.
If he is wrong about the offside call, as he let the action goes to completion, the VAR can check and allow the goal . If he raised the flag instantly, there is no action to be reviewed by VAR.