Every rule has an exception.... :)
My rule is to never get off my horse for something like this. One reason is that I believe you have more "control" from the saddle than you do from the ground.
Horses are usually smarter than many people give them credit for. Especially when it comes to finding ways to get out of work.
If your horse gets scared of something and your answer is to get off and walk him through it, the horse will quickly figure out that getting "scared" of random objects will result is a break from work.
Shortly after I pulled shoes from a horse, I was riding him on trail. Even though his feet were good, I was very concerned about stone bruises and hurting his feet when the terrain got rocky. At one point on a ride, he felt a little off. I dismounted, got out a hoof pick and checked his feet for rocks or problems.
Same thing happened a few miles later. Again, I dismounted and checked his feet. I also walked him a little to see if he was actually "off."
First, there was NOTHING wrong with his feet. I made sure of this when I got back. That didn't stop the horse from oddly becoming "off" in both those same places the next time I rode him. It took a while of not stopping, but I finally got him past a "bad habit" created by stopping only once in each place. (BTW, there was nothing special about these locations that could have caused any actual discomfort or account for the behavior).
Interestingly, a few months later a friend rode my horse out on the same trail. She later told me that she thought he felt off, but it went away after a short time. I asked where it happened, and it was the same two locations as before.
There are several approaches for dealing with scary objects. Some people like to inch their horse up to the scary stuff and have them get over it. Others just "ignore" the scary stuff and ride by it at a brisk pace. Both work.
You shouldn't have to fight with your horse to ride through. How to handle it and what options there are depend on the situation...
A big log across the trail: If your only options are go forward of go back, you have to figure out a way thorough. If you can go around, you can work on getting a certain distance today, and maybe a little closer tomorrow, and closer the day after.
You never know what you may come across on trail - a dog, a plastic bag, a homeless person. There is no way to account for every possibility. The trick is to build a foundation through consistent training. Have a training plan to deal with a scary situation, and implement is consistently (i.e. don't let the horse run away this time just because you don't have the time/patience to do some training right now).
That, and lots of miles (which build trust and confidence between rider and horse)