Is this an error in the updated Harry Potter Diagon Alley build/instructions?
The wall behind the shelving unit is not a standard wall built with regular LEGO bricks, but a panel, which is hollow on one side.
The parts that are sticking out at the back of the bookshelf are accommodated by the hollow of the panel.
My guess is that you attached the panel backwards with the flat side facing in, instead of out. Look at Page 37/Step 48 where the panel is attached. The hollow part should be facing in.