I haven't read the book but I take worth there to mean "would cause a delay equal to that of two locked doors and a trick staircase". I base this on "when you were late for class", that is, in a hurry to get there.
I also feel it's an ironical/amused way to word it. Otherwise, it might write somthing like: "Peeves the Poltergeist cost two locked doors and a trick staircase"