Among other curious idiosyncrasies, fertile humans can have child-free sex thanks to various contraceptive methods. Therefore pregnancy is usually a more or less conscious choice, and usually not an accident anymore (happy or not). So why do humans want to have children?
Life as a human often includes periods of depression where the dreadful absence of meaning feels so obvious. Some people might escape it thanks to distractions or simple oblivion. Assuming that most people have at least a vague feeling about this, it is possible that we would all seek the reassuring feeling of being important to some other people. In the worst case, if one contemplates suicide, the thought of having people who like you and want you to live, especially if they depend on you, is likely to stop one from going through with it. Thus we humans might unconsciously anticipate suicidal thoughts, and preventively surround ourselves with people who like us and depend on us.
Children.