So the boy finds the hoard, sees a book in it (which inflames his desire to become literate) and takes it, (then unclear something something quest something diary something plot thickens something,) resulting in him eventually slaying the dragon, but he finds that the book, not being back in the hoard when he slays the dragon, prevents the quest from being completed? Thus he becomes the dragon.
In order for the girl to be deciphering all this, the boy must have written of it in the diary - before becoming the dragon?
Is the diary magical or sentient or is it an ordinary book? Is the entire hoard made up of ancient books? What if the boy doesn’t steal the book outright, but somehow gets the original dragon to lend him the book upon promise to return it after a fortnight, not realizing that the curses that librarians the universe over mutter under their breath when books are late or ne’er returned will manifest in force and turn him into a dragon himself, forever doomed to be missing part of his library, if he fails to return the book timely? *tongue slightly in cheek*