Gillg and Andrew Tarr are both right to a point and it’s also true that some illegitimate children received their father’s family name as a middle name. My gg grandfather gave his first wife’s family name to their 3 children in the 1840’s.
But that proves very little, if the current fashion was to use a 'family' middle name. It may have added respectability to an otherwise naughty birth; it may have assisted with later inheritances; but that doesn't prove an original intention.
It certainly helps our later researches though.
This was the case with an ancestor from rural Lincolnshire, where the son later took the surname of the man her father had married a year or so after his birth as a middle name. But the baptism was just under the mother's maiden name with no father listed. Whether he was actually the father, it may be lost in the mists of (DNA) time. If he was the father, I wonder even then if the rural conservative society would have permitted him to use his father's name. On the other hand, with some London ancestors, a widow shacked up with a new man and had five children by him, all baptised as if legitimate at one London church, but they didn't bother getting married until they were finished, half way across the city! The children all used the father's surname with no hint at illegitimacy throughout their lives.