The "problem of evil" argument posits that there is some "evil" defined by the belief system which the belief system admits to exist and then contrasts that with supposing that the creator being in that belief system simultaneously does not want such a thing to exist and has the ability to prevent such a thing. In the scenario you have prevented, there is nothing to indicate that the moral system which includes this story would believe that an act done here would be evil, and therefore this is not related to that question.
Here, you are attempting to define as "evil" something that you as the reader, or Moses, a character in the story, believes to be evil. However, the story indicates that the problem is that you only perceive it to be evil because of your lack of omniscience. This doesn't cause a problem for a religious system because it is expected that people are not omniscient and even secular moral systems acknowledge that lack of omniscience can lead to being mistaken about what is and is not an evil act.
We might be able to derive some things from the story. We see that the better end in that religion, according to the story, is for children to be killed rather than to pressure their parents into defiance or disbelief. So, perhaps we could say from our observation that since there are living children who Allah didn't have killed who do pressure their parents into disbelief, then Allah is either incapable or unwilling to prevent the evil of letting those children live. Unfortunately, our lack of omniscience doesn't let us know whether or not there is some greater good which Allah sees to account for allowing the "evil" of letting children live, so we still cannot assume that it is a lack of ability, so it is still not a good argument from the "problem of evil".
The story itself isn't attempting to defend the values of Allah, but to show our inability to know what actions are actually good. It presumes that the reader already would accept killing a child to be a better thing than letting the parents doubt their belief. If you did not value the parent's beliefs over the life of the child, then you would have to find other passages which would address that matter more specifically.
Addendum regarding moral intuition
After reading the answer by @Dcleve on this post, I wanted to give a little further clarification and discussion regarding moral intuition, our innate sense to discern good, in the case of this account. I personally believe that it is an error to presuppose that our nature and intuition regarding morality can supersede direct revelation from an omniscient creator. This generally seems to provide a very weak argument against the moral claims of a religious system. In order to evaluate the effectiveness of our moral intuitions, we must do so from within the framework of the given belief system.
So, I did a quick investigation on how Islam handles this. I am not a scholar of Islam, so I cannot confirm, but one of the first links I found was this call from a pro-Islamic site to Follow your conscience in Islam. It suggests things such as:
If something waivers in your soul, then you should abandon it.
Source: Musnad Aḥmad 21695, Grade: Sahih
So, it would seem that perhaps Islam might affirm our intuitions about morality. I also learned about the concept of "Fitra", which explains the moral conscious by suggesting that we have some intuitive knowledge from a pre-birth state.
Clearly in this story Moses has a moral intuition, as is probably expected to be the case of the audience, that killing a child is wrong. There is no doubt that this act makes him "waiver in his soul". And yet, the story depicts the killing of the child as good and Moses' intuitive reaction as (perhaps mildly) "evil".
So, problem of evil here is the question of why Allah allowed a (ostensibly?) good person such as Moses to have evil moral intuitions. What we would have to ask would be whether Allah in fact wanted to make Moses with evil intuitions or whether Allah was unable to prevent Moses from having evil intuitions. The problem would only exist if neither one of those options could be true.