I can't remember if it was in the book or not. It definitely wasn't in the stage musical.
In fact the pacing of all of that was better - Javert just arriving to the town, Valjean being distracted by Javert's presence in the factory, when on stage he just walked off and left things to the foreman. On stage he rescued the man from the cart after sending Fantine to the hospital, which struck up the whole conversation between him and Javert about Valjean being arrested.
That's another reason I want a complete soundtrack.
All of that Javert/Valjean back and forth was new. I want to hear it again, and it's not on the current soundtrack, dammit.