The point of lungeing is not to lessen energy but to develop reactions, and the horse will not draw anything from being lungeing (him like mad) after he might negatively react to what you are asking. The fact that he over reacts to a bat/whip shows holes in the education of the horse imho. And there is reinforcement of an aid, not 'spanking'.
Horses are rarely stubborn, they are mixed up by what is being asked. The question is why the horse goes into a rail in the first place. And how tactful the rider is in PLANNING the use of aids/figures, and if they know how to plan the exit into the next movement as well.
The solutions to all these things are rider based, you have to ask the horse in such a way that it can say 'yes'. That might mean going back further in training to more simple actions, or having better timing, or having your teacher show you. It is NOT about dominance but CLEAR leadership.