How necessary is anchoring a bookshelf to drywall?

That’s a good point. I was assuming you’d have the books pushed in to the back of the shelf. This means the center of gravity has the shelf leaning in to the wall. If you have the books at the front of each shelf, the center of gravity will also move forward and make the shelf less stable.