Look at the penalty statement for 9-2-1-a-1 and AR 9-2-1-VIII. Because this is a foul by nonplayers, it is enforced as a dead ball foul even though it happens while the ball is live. It does not offset a live ball foul.
If you want to get into unfair acts, then you can look at equitable solutions. In this case, Team A will not get an untimed down because IFP has a loss of down. So whether he scores or not, the penalty will be accepted and the score canceled and the game will be over. So the equitable thing to do would be end the game anyway. The other thing to consider is that both teams had nonplayers on the field. Obviously Team B had more, but Team A did have team personnel (including one without a helmet on) on the field. If you’re going to say Team B affected the play, then so did Team A. But, again, in the end it doesn’t matter because of the IFP.
But if you want to talk about similar hypotheticals, change the IFP to OH. Now it matters whether he would have scored or not. If he scores, Team B has to accept the OH to cancel the score, but that would give Team A an untimed down. So now you can get into deciding what is equitable.