I’ve heard this thing about not writing for “the market” because by the time you get there, the market will be elsewhere. This is usually accompanied by some bad advice about write what you love, write for yourself, blah blah.
No. Write for the market first and then write for love and so on.
If you want to be a children’s book author then you need to know the genre well. Page counts, chapter lengths, illustrations, how they use cliffhangers, what minor rules you can break and how every other published author out there did it. This means buying a chapter book and counting words and page numbers. It means working out that Kim Possible: Monkey Business is 6490 words long with an average of 84 words per page and in eleven chapters there were 4, 5, 6, 8, 7, 6, 7, 9, 7, 9 and 10 pages in each chapter. It means taking this format and strictly writing to it.
If you can do this then you can write a children’s book. Following that format will give you freedom, rather than lock you in and it is the same for any genre you care to name.
You want to write horror? Then you should know the word counts, chapter lengths and tropes of the genre. You write erotica? Then you should know how they handle the end of a chapter.
Non-fiction is the same. Look to what exists and copy it. In this adherence to form, you’ll find style and beauty.
If magic is selling bucketloads then go ahead and write a book for that market. By the time you’re finished the market will still be cooking away and even if it’s dropped off a bit, you’ll still have a good book for when it comes back.
Oh, and all you picture book writers out there: a standard picture book is 32 pages. If you don’t know this then you have no chance of getting something published. Write to the structure.