In addition to the double entendre mentioned in other answers (that Yoda knew that Rey had literally taken the books with her), and Yoda's belief that Rey would successfully learn to use the Force with or without the books, another interpretation is that Yoda believes that being a Jedi is more about character and intent than any specific scholastic tradition. This would represent a departure from Yoda's earlier characterization of being fairly inflexible and dogmatic towards Jedi tradition (initially refusing to train Anakin due to his age, demanding that Luke continue his training rather than save his friends, etc.), which is why it's shocking to the viewer that he initially appears to be burning the books himself.
The theme of masters burning their sacred texts once enlightenment has been achieved appears in multiple Zen koans, which inspired some aspects of the Force that appear in the other films. For example:
Once there was a well known philosopher and scholar who devoted himself to the study of Zen for many years. On the day that he finally attained enlightenment, he took all of his books out into the yard, and burned them all.
The Zen master Mu-nan had only one successor. His name was Shoju. After Shoju had completed his study of Zen, Mu-nan called him into his room. "I am getting old," he said, "and as far as I know, Shoju, you are the only one who will carry on this teaching. Here is a book. It has been passed down from master to master for seven generations. I also have added many points according to my understanding. The book is very valuable, and I am giving it to you to represent your successorship."
"If the book is such an important thing, you had better keep it," Shoju replied. "I received your Zen without writing and am satisfied with it as it is."
"I know that," said Mu-nan. "Even so, this work has been carried from master to master for seven generations, so you may keep it as a symbol of having received the teaching. Here."
The two happened to be talking before a brazier. The instant Shoju felt the book in his hands he thrust it into the flaming coals. He had no lust for possessions.
Mu-nan, who never had been angry before, yelled: "What are you doing!"
Shoju shouted back: "What are you saying!"
In these stories, the lesson is that while tradition and collected teachings may help achieve wisdom, they are not themselves the end goal of wisdom. This seems to be what Yoda is saying, that the practice of doing the right thing is more important than mastery of theory:
Page-turners they were not. Yes, yes, yes. Wisdom they held, but that library contained nothing that the girl Rey does not already possess. Skywalker, still looking to the horizon. Never here, now, hmmm? (pokes Luke with his walking stick) The need in front of your nose. Hmmm?
(Note that this lesson is somewhat undercut by Rey having the actual books, and later using them to fix her lightsaber and track down Exegol in The Rise of Skywalker.)