Symbolism, Imagery, Allegory
In Matilda, books are gateways. They're escapes. Matilda latches onto them as soon as she can, and starts reading as though her life depends on it. First the library is her escape from her family life; then, by using books, her mind itself becomes her escape hatch.
Take a look at the reading list Mrs. Phelps puts together for Matilda (it's all there in the "Shout Outs" section, along with other books Matilda reads and other authors she knows about). It's really advanced. In fact, it's a reading list you might see in a college literature course. This isn't Where the Wild Things Are and Goodnight Moon. It's Tess of the D'Urbervilles and Animal Farm. The reading list Mrs. Phelps makes for Matilda would probably fit in just fine in an advanced college literature course. And whether the book is by Dickens or Steinbeck or Hemingway, Matilda eats it up.
If we're looking closely, we can tell that she seems to prefer books about adventure. These books' characters do things (they take action; they don't ask for permission), and by reading, Matilda gets to do those things, too. It's a pretty nice thing for a little girl whose home life lacks well, fun.
Books Make Buddies?
Sure, books bring together Mrs. Phelps and Matilda, and give her an in with Hortensia. But books also help to keep her apart from her family. In one of Matilda's more violent scenes, Mr. Wormwood tears up Matilda's borrowed copy of Steinbeck's The Red Pony. There's nothing she can do to stop him. He doesn't touch her or hit her, but when he's ripping the book apart, it's almost like he's ripping her up, too. By hurting something she values, he hurts her. And the fact that he doesn't value reading, when it means so much to Matilda, shows that he doesn't value her either.
Book battles also occur between Matilda and the imposing Trunchbull. A shared knowledge of Nicholas Nickleby brings Matilda to the Trunchbull's attention, for example. Of course we know right off the bat that this can't be headed anywhere good because a kid definitely does not want to have anything in common with the Trunchbull.
Of course even though they've both read the same book, it doesn't bring them closer together or help them understand each other. Instead, it's an excuse for the Trunchbull to criticize the poor girl. The Trunchbull, too, doesn't seem to get how awesome Matilda is, because for the Trunchbull, the fact that this little tyke can read Dickens is just one more bothersome thing about one more bothersome kid.
It's painful to see adults attack what Matilda holds dearest—her books and the stories within them. In a way, as Matilda disappears into these books, she is creating her own identity and her own escape. By lashing out at her books, they're squashing Matilda's spirit. But it's lucky she's read all those books, because with all that food for her imagination, Matilda has the perfect plan to get them back.