This is a closer scenario, since billions of e.g. cows would not be born and raised if not for our use for them as food. (Of course, in reality, they're mostly not raised happily).
When deciding the answer to the scenario, keep in mind that most parents who have children with e.g. terminally ill diseases, who die in adolescence, or even kids that die as teenagers from accidents, would probably not say it is better that they had not lived.
Also worth considering - we have children knowing that their lives will tragically end in death after 100 years at most. Why is that not wrong? Just cause we're used to 100 years being a lot, doesn't really change the fundamental argument does it?
There is obviously not going to be a simple happiness score at each moment of life—it should at least be a vector of scores. Would make sense to integrate over time, but then there's the spectre of a "happiness maximizer" (like a paperclip maximizer) that might produce undesirable outcomes, whether it's average or aggregate happiness you consider. Ethics is difficult to formalize.
"On his faculty page, Mr. Singer argues: “Newborn human babies have no sense of their own existence over time. So killing a newborn baby is never equivalent to killing a person, that is, a being who wants to go on living. That doesn’t mean that it is not almost always a terrible thing to do. It is, but that is because most infants are loved and cherished by their parents, and to kill an infant is usually to do a great wrong to its parents."
https://m.washingtontimes.com/news/2015/jun/16/peter-singer-...