If going to Heaven were just a matter of choosing it, as though it could be chosen with no more effort, deliberation, or temptation as choosing what color pair of shoes to throw on, why even get baptized at all? Just a rhetorical question to encourage you to consider whether you are asking the right question.
The doctrine of original sin has it that all men (usual caveats here) have fallen short of the favor of God, and specifically that they have failed to inherit the state of justification of their first parents. That being the case, no person 'out of the box' deserves heaven. To be made deserving, they must pass into the state of justification, which culminates in perfect love of God (charity). A developed intellect is necessary to achieve this state because one cannot love what one does not know. Baptism, however, infuses the theological virtue of charity (along with its concomitants: faith and hope) even in one whose intellection is still in development. Baptism justifies. That, at any rate, is a mechanical explanation of why/how baptized infants go to Heaven.
You do bring up an interesting point about babies in Heaven not 'knowing' God, and I am extremely open to the idea that this population, prior to entering Heaven (or upon entering it) has full intellect/will capabilities. It almost seems necessary, given that Heaven is always described as a place where God is known and loved-- something that requires a developed intellect and will (think, at minimum, that of a seven year old on earth).