Barring the child being trained in a specific feat or some specific magic being used, there's not a "the protecting creature is auto-hit instead of the targeted creature" by rules-as-written. However...
The cover rules include an automatic +4 to AC for another creature providing cover, giving a +4 to AC. Many GM's play this where a miss by 4 or less hits the cover, rather than the targeted creature, though again this isn't part of the rules-as-written. More importantly, the significant size difference between even a very young human and a tiny rat could allow you some room to declare the rat has either improved cover (+8 to AC, and you'd be in your rights to say misses by 8 or less hit the child) or even total cover and/or total concealment, making attacks against the rat impossible.
As a one-off effect, having the first shot hit the child as (s)he dives in the way is fine, although things like precision damage shouldn't apply (hopefully preventing the party from accidentally murdering the child in a single attack). If you can hint that this will happen ahead of time somehow, either generally or as the result of a skill check (Sense Motive or Perception, maybe), the players shouldn't feel they were cheated just because there's not a specific rule to cover it. That's the point in the GM after all - things can happen that aren't scripted like a computer RPG.
If they continue to attack despite the +4 or +8 penalty and kill the innocent child at that point, that's entirely their fault, and while I'm not usually a fan of "one-time" effects affecting alignment based classes, this could easily be an exception, in my opinion.