To be fair the children’s story came first. In that regard Tolkien and Rowling had something in common, their first books were written for a much younger and simpler audience. It wasn’t until they took off commercially that the more adult and deep lore was developed.
EDIT: I’m wrong
What? No. First was the story of Arda in a prototype version of the Silmarillon and Unfinished Tales.
Huh, interesting, I didn’t realize Tolkien had started writing portions of the Silmarillion in 1914. I had to do some looking based on your response and learned something.
From what I know, he never really wrote “for” the silmsrillion either. He wrote stories for him to flesh out the history of the world but not with the intention of publishing such stories. Some of them were even just notes about what happened in the world and some weren’t finished.
Someone correct me if I’m wrong