People are also really bad about evaluating potential consequences. A person might not be able to imagine themselves killing their own child, so they might ignore the possibility since they think it can't happen to them. They might be able to imagine getting arrested and put in prison, though, and thus making it a crime could make them think twice.
This seems to me like an obvious case of criminal negligence, which merits punishment for all the same reasons that any such negligence would.
I would also say that it should be criminal merely to leave a child in a car like this, even if the child survives. That would go a long way to deterring people who think they're somehow immune. If the child does die, you should still prosecute the act of leaving them, even if you aren't necessarily prosecuting the death. It would be crazy if the punishment were lower if the crime resulted in death.