You're right that most of the time www.example.com and example.com are equivalent. But they aren't necessarily equivalent, which is why assuming they are identical is problematic.
Your suggested modification will be correct 99% of the time, but will be incapable of handling the other 1%. The current system is correct 50% of the time, and can correctly handle the 1% that the proposed modification cannot.
Philosophically the current solution seems to suggest it is better to be less correct on average but correctly handle edge-cases. As another consideration, the userbase can correct mistakes in the current algorithm, whereas they cannot correct mistakes in your proposed algorithm.