Which is why changing jobs is the only way to get paid what you're worth: management has neither the backbone nor the incentive to price things properly. So instead we perform the cognitive hack of two underpaid employees trading jobs, because as you said, "The easiest time to give an employee a raise is during hiring."
I figure the only way to really fix this 'the only way to get a raise is to leave for a year' method is to figure out how to include retention in engineering manager's perf evaluation.