1. The P-40 was a better fighter bomber than the Spitfire, in any model, especially if high altitude performance was not a factor in the missions.
2. Sometimes good enough is good enough.
I don't think anyone is disagreeing, but that's not why the P-40 was not replaced in theatre within the RAF. It was not replaced because of numbers. Having more is better. Let's not forget the Spitfire was a better fighter than the P-40 hands down and was not designed as a ground attack aircraft, but, as you said, sometimes good enough is good enough.