>>The M3 might not have been great compared to the Panzers
German commanders in Africa considered it a match for the the Panzer IV, up until the IV-F2.
And it was considerably better than the same-era Chieftain. The expression 'arms race' sums it up.
Also, the major difference between Grant and Lee appears to be whether the radio is mounted next to the commander (Grant) or not (Lee) - and some later-variant turrets never got converted into the modded-for-Brits version (Grant).
>>The M4 Sherman eliminated most of the design flaws
There was a lot of parts interchangeability between M3 and M4, meaning many (most?) assembly lines didn't need to be retooled, and parts stock could be used for the newer model.