As the saying goes, "If you're not a liberal when you're 2.5, you have no heart, and if you're not a conservative by the time you're 4.5, you have no brain"
But after a bit of digging I got to this: https://quoteinvestigator.com/2014/02/24/heart-head/
Conclusion: many forms, many misattributions, many transformations by various authors, but the saying is definitely not made up.
Folks I know who were middle of the road, would now never consider voting for a GOP candidate in national elections. It wasn't the individuals I have in mind who changed.
I think that saying was already obsolete in the beginning of this century, at least in my experience.