One of the books that got me interested in cryptography as a kid was Artemis Fowl! It might be too simple for him now, but the gnommish (glyph substitution cipher) on every page was really fun for me to figure out.
Lemony Snicket’s A Series of Unfortunate Events have some of this too, especially the Unauthorized Autobiography. My little brother once encoded a secret message into one of his essays on a standardized test using the Sebald Code!