Have had some of this, a bit within therapy context if curled up on floor (SE)...just tiny bits of that come up but I'm conscious or aware in present-time so manage to not do damage. For me it's a little anger or feeling like I can't get comfortable no matter what I do. From a baby place it would have less to do with belief-thought stuff, though that is slowly forming (and conscious self harm isn't really a baby thing), but just a pissed-off impulse and reflex to do anything to feel more settled.
If they can't self-soothe or can't access any help through their crying, especially if this is repeated, babies can shutdown (nervous system kicks into a freeze so they don't hurt too much). That's how I experience abandonment and fear of bodily harm stuff. For me the adult self injury is actually a screwed up self-protective impulse that bears little relationship to an impulse like baby head-banging. But either way, if self-soothing is accomplished, shutdown/freeze is averted. Shutdown can feel like nothing at all, but the edge of it can feel like impending annihilation...which is scary. The sympathetic nervous system is kicking high gear right before a crash into complete helplessness.
Like others have mentioned, head-banging among babies is not uncommon, but I do notice the sense of frustration or discomfort (very common reasons)...and how a little head banging is a reflex aimed at calming down.