This is a custom or habit. Some surname groups put the words representing generations in the middle of the three words, while others put them at the end. For example, Yang is a generation, and his own name is Yang Qianhou. Hou is also a generation.
But now, many people don't follow this arrangement. Just memorize it in your head, don't show it in your name.