I checked Japanese Wikipedia and お天道様 is an early Edo period word for the sun, as used in some kind of early modern popular religion that is not really described well at all. Anyway, I've never seen a word like this in any children's book, so how do kids know what their grandparents are talking about? It seems like if it's a word nobody understands, the grandparents should just say お日様 instead.
This is an interesting question but I don't think it's really Japan-specific. Japanese kids learn the word お天道様 the same way kids everywhere learn words.
I mean, how do kids in the US know who "God" is? If anything, it should be easier to figure out お天道様 -- at least Japanese grandmas can point to a concrete placeholder... I'm sure there are many Japanese kids who grow up with idiosyncratic understandings of what お天道様 means, but again, the same could be said of "God".
It seems like if it's a word nobody understands, the grandparents should just say お日様 instead.
But it isn't a word nobody understands -- it's a word (almost) everybody understands, even if they can't put their understanding in simple words. Plus, if grandmas said お日様 it wouldn't really make sense. There is obviously some overlap, but watching over people and disapproving of naughtiness is just not something that お日様 does.