Most (literate, educated) Indians have been trained the same, and it has very little to do with religion. When you do accidentally step on a book though, each religion has their own format - Hindus touch the book then touch their head then chest in penance, Muslims lightly kiss the book or touch the book/bag and kiss their hand, Christians touch the book and cross themselves.

This is something I've noticed is uniquely culturally Indian, and transcends all religions. Which is beautiful.

I was once whacked in the head by a teacher for throwing a book onto the shelf, and rightly so.

I also try to teach my children to be careful with books but beating a child surely cannot be the the right way. If we adults strike children for them treating possessions badly, are we then not saying that they are less worthy of good treatment than possessions? That would be deeply humiliating to me.

And I highly doubt that, in general, 'whacking' children will make them grow up kinder more compassionate adults.

The behavior sounds like superstition. Is there a belief that something bad will happen if the ritual is not performed?

Can't speak for op for but me no - it was just ingrained as something disrespectful to do to books. Sometimes you've got a taboo like eating with your left hand that has a pretty clear reason for coming into existence (you use your left hand to clean up in the bathroom and before hand soap in the era of everyone dying from cholera might as well keep those functions as physically separated as possible) but this is more just something you would be disrespectful to do

Perhaps it is regional. Where I grew up the error-repair gesture varied certainly (forehead, lips, etc.) but I went to Catholic school for a while and I do not recall the distinction being neatly by religion but my memory isn’t that sharp of that period of my childhood.

Considering the rationale offered by Hindus, I’d be inclined to believe it is a Hindu custom adopted by everyone else by virtue of relative numbers. Sort of like how Christmas is secular in the US, Diwali in India, and perhaps weaker something like Eid in Jordan.

So I agree, very little to do with religion today, but perhaps not so always. Something like Halloween perhaps.