Over the years I've had a few guns that had overly sensitive magazine release buttons.
One of them I replaced the button and that helped the problem.
Another gun, I just sold the gun and let it be somebody else's problem -- or maybe it would not be a problem at all for him depending on how he used it how he carried it or what model holster he used.
For two other guns I have actually taken a Dremel tool and ground down the magazine release button so it doesn't stick out so far and cannot be so easily pressed against my body or the holster to release it. It can still be pressed with your bare fingers or a fingernail, no tools required, but it takes more of a concentrated effort and isn't as fast as popping out the mag had been.
For small semi auto pocket-size pistols, I don't usually carry a spare magazine anyway so I'm not so worried about being able to do a tactical mag swap in combat.