That's why we have the vaccine trials.
They're the very last step in testing a vaccine. And there really is no other option: if the end result is going to a vaccine given to small children at some point you're going to have to give it to some small children and see what happens. The only way around it is to not vaccinate children at all... which doesn't seem great from an ethical standpoint given the number of lives that have been saved by vaccines.