What if reincarnation? When someone dies in the Matrix, their body gets reconnected to another baby in the Matrix. As for how the human population is maintained outside of the Matrix... either the machines keep catching more humans, or something like artificial insemination. Or cloning
That would actually be a good idea. With people growing up and learning on their own, you don't have a fully controlled system. The world inside the Matrix will be evolving and from time to time there will be some glitch somewhere. If you have a base of defined childhoods, then only physical differences between bodies and random occurences inside are uncontrolled
If I were to construct the Matrix, I would go after cloning (fewer biological lottery) and predefined lifepaths to keep everything nice and stable