I walk with my collie through and by farms often enough. Only once did we have an issue and my wife was with me at the time.
Thankfully we had sticks with us so we went back to back circling with our old dog in the middle and got to a gate and beyond to safety.
I usually pick up a big stick if one is around and I’m approaching a farm (these will be on my map)

