Hello mommy! My son does this a lot too when he was that age. One of the possible reasons why he's doing it because bumping his head caught your attention. Our child usually tend to repeat actions na nakukuha attention natin. (This is based on my personal experience po.)
What I did was I talk to him na bumping his head won't get my attention. Sometimes tinitiis ko talaga na wag pansinin pero I made sure na di malakas yung pagbump niya. Pag nilalakasan niya, tinatabihan ko lang siya tapos nakaabang kamay ko kung saan niya inuuntog without talking and without eye contact para gets pa din niya na di niya makukuha attention ko sa ganun. Eventually na outgrow din niya yung habit niyang ganun.
Hope this helps po 🤍
Magbasa pa