Actually, that's not quite the case.
Every society has a law like "no murder -- except sometimes, when you can".
And a law like "no stealing -- except sometimes, when you can".
And sometimes trying not to cause pain does make the world a worse place. Would you have police officers try their hardest to avoid causing pain? Criminals feel quite a bit of pain when they are incarcerated.
Nothing in the world is ever so simple as you suggest.