The first infringement is the foul, not the offside.
As it clearly states '... is fouled BEFORE playing or attempting to play the ball...'. In other words, the offside infringement hasn't occurred before the foul.
Being in an offside position - i.e. in a position closer to the opposition goal...