It's prey instinct or being startled by or experiencing pain from high frequencies you may not hear.
Small animals squeeling is a trigger for many dogs.
Tune it right and they may sing. One of ours would sing sometimes, another liked to jump on a wide round ottoman and watch, the last watched a little but really wasn't into it. He might be mad he was outgrowing the Ottoman..strange pouty mastiff stuff, lol.
Anyhow, if you put G on the floor they go nuts and bark like crazy at it. Powered or battery op, they hate G scale and will nose roll them to test for vulnerabilities.
Put down an O track and they tiptoe around it, lay down and watch.
I'd like to think they have good taste but again, I think it was just frequencies they didn't like...
Ah, like a dog whistle. Which a lot of dogs don't actually like unless tought to like it .