I started playing piano at three, and taking lessons in composition - I was putting notes on paper just a few months after starting to play. I was still three. I started getting actual training in composition and theory at about 6. I was in Israel at the time. Not unusual if also starting to play the piano at an early age.
Children learn everything by imitation.
That's how everyone from before Palestrina got started. What I usually label Op. 1 was a piece I wrote between six and seven in memory of my grandmother. It was a five-miniute piece for piano. There were lots of early influences.