That's a tough one - I'm guessing that's part of the stock firmware, and I'm not even sure you could change that behavior even if your phone was rooted, unless you wrote a custom ROM. But I only know enough to be dangerous ;-)
A search through the app store might turn up something useful, or it may be worth posing this question over in the XDA forums where all the heavy hitters hang out.
[Edit: A quick search of the play store shows a ton of apps that allow you to use software controls to do all kinds of stuff with your volume settings, but I didn't come across one that allowed you to prevent an inadvertent press of the hardware keys from doing what you described. It did seem like some of them had confirmation settings, though, so perhaps that would be adequate?]
Sent from my rooted, debloated, deodexed Sinclair ZX-80 running CM -0.001 using Tapatalk 2