I actually checked the rulebook on this and couldn't find a clear statement. It seems to me that it would be the same as an in-bounds pass that gets thrown out of bounds without anyone touching it. The ball goes back to where it was thrown in, doesn't it? The only difference here is that the location of the foul may trump the location of the in-bounds pass that was never touched in play.
From the casebook...this is the situation closest to how the play occurred:
A.R. 106. B1 deflects the ball away from A1 while:
(1) A1 is dribbling the ball; or
(2) A1 is passing the ball to A2.
A1, in an attempt to recover the ball, fouls B1.
RULING: In (1) and (2), A1 has committed a team control foul. The
foul shall be charged to A1, and the ball shall be awarded to Team B
at a designated spot nearest to where A1’s foul was committed.