Killing a person is murder, a crime because someone who arguably did not want their life cut short is now dead. But if the killer and the "victim" are the same person, no crime has been committed because the underlying argument for why murder is a crime no longer holds. You can't be both the perpetrator and victim of a crime.
The same is for a kid who takes and sends pictures of him/herself. Child pornography is a crime to prevent bad people from taking advantage of kids and documenting it for whatever sick reasons they have. But a kid can't be both the perpetrator and victim of that crime.
In normal situations when you run into such a logical fallacy you have to discard it. But this is the law we're talking about and there's no such need. So yes kids can get prosecuted even though no crime has taken place. It's a symptom of people doing their jobs exactly by the book with no thought whatsoever for if it's the actual, correct thing to do. It's too bad.