So "oleh" is not necessary here after "ditulis"?
Yeah, oleh is normally optional. Though I assume required in formal contexts.
why cant: this book is written for children
Because that would need a different preposition, such as "buat" or "untuk"
written for and written by are completely different meanings ----
by means that the children wrote it ----
--For means that someone wrote it for children to read