Sure, but again, that is a highly localized decision based on your judgement. There wasn't a formula that said you should give raises once market rates exceeded your payroll by x percent. I think tactical moves like the one you made are great.
On your other point about companies being inefficient, I think we should stop worrying about whether employers or companies in aggregate are being efficient. In fact, I want them to be inefficient. It gives people more opportunities to take advantage of inefficiencies.
I suspect we have some sort of bias in which we apply fairness rules that are good for individuals in a community and apply it to "the system" which is not just a scaled up version of individuals interacting which either. We like to think big companies operate as a unified entity, but really, there's a lot of shit going on under the hood that may lead to very weird "irrational" decisions, many of which an individual could take advantage of.
Generally, I just prefer people to be more opportunistic, rather than trying to make sense out of non-sensical systems.