5th grade seems like an appropriate time to start educating students about this as part of their health curriculum. That's the grade when they gave us the puberty talk in my old school district.
Some early bloomers absolutely start puberty during or before 5th grade.
Yes they are two different things but they are related. Puberty can be devastating to a child who isn't comfortable with their body. In some cases puberty blockers are prescribed to delay the physical changes for children with gender disphoria. So educating gender identity along with puberty isn't a bad idea.
And yes, some children do start questioning their gender before they start puberty.
But this is all speculative. We don't know what the context for this teacher reading the book, but calling it inappropriate for their age is wrong.