I think people overwhelmingly voting in line with their group is the effect, not the cause. People start off by being in a group, and their group teaches them what's good and what's bad, as well as how different policies will affect them personally. Mind you, they're most often taught wrong - but uniformly wrong within their group. They're similarly taught about WHO's good and WHO's bad, and how different political parties will affect them personally. Loaded with all these misconceptions, they apply the self-interest mindset and end up with a voting pattern that to an external observer doesn't look like self-interest at all. That's an oversimplification of course, everybody is part of multiple overlapping groups at every point in time and joins and leaves groups frequently, creating a gradient of opinions in a society. But the main mechanism is the same.
The result is mostly the same as with your explanation, except yours doesn't explain why there are primary elections and how they can be so unpredictable.