I spent nearly two weeks in the hills of Romania near the village of Tescani. I wasn't hiking, but spent each day walking the dirt road into the village.
Throwing rocks was very common practice by some of the locals to keep some dogs away. And the Chinese.
There was a girl with us from Korea. One day we were walking over a bridge into town and all of a sudden we heard rocks pinging off the metal bridge. Looking back, there were children from the village yelling and hurling rocks at us. Our contact person said they were yelling at our Korean friend because they thought she was Chinese. Apparently, they didn't take to kindly to her.
Anyways, feral dogs are simply part of life there. Remember, you're the odd duck.