Great topic. There is a lot to dig into, here.
"Happiness" is a vague, hard-to-define concept. It can refer to a fleeting feeling, or to a stable sense of contentedness with life. As I've discussed with others on here, there are also issues with self-evaluation of what makes someone better off. So, when we go to define "good," we have to take into account that "happiness" has a very loose meaning.
You seem to acknowledge the issue of actions not being ceterus parabus in a vacuum, but that is an important consideration as well. Beyond what you are saying about the closed example of the victim and the perpetrators, what about:
- The lasting effects this trauma will have on others connected to the woman. Her friends, family, and future will all be affected, as well as anyone else she comes into contact with.
- The effect of getting away with such a crime will have on the perpetrators, who will be more emboldened to commit further harm unto others.
Plus, there is an obstacle that even if we allow for a hypothetical where no one finds out, we are trying to define "good" on a societal scale. If our definition of good allows for such things so long as they occur in the dark, behaviors will change. People will be more frightened, less trusting, and less cautious. A lessening to happiness.
In this way, when we come around to define "good," we have to consider all of those factors which affect happiness. A community full of trust, love, and support will yield the greatest happiness on average, so we define good to further those interests.
As opposed to happiness, hurt is much more clear and easy to define. We can have a discussion about whether the crime is actually good for the perpetrator's happiness (think guilt, mental stability, loss of connection to fellow humans through such dehumanization of the victim), but there's really no argument that the victim has been harmed. This gives us a clear rule that breaks your hypothetical, "harming others is bad." Now, yes, sometimes actions may harm others in indirect ways, eg. if I get a promotion someone else has been denied that promotion, but that is a separate and more nuanced discussion. In general, if you take an action that primarily involves harming someone else, it's bad.
In sum, we get the concepts of good and bad from measuring net changes in "happiness" to the system, acknowledging that effects on individuals can be far-reaching beyond that one person, and further acknowledging that the standards we set will affect behavior and outcomes based on fear of certain consequences. To minimize the effect of rippling effects from someone being hurt, we prioritize stopping "bad" from one person directed at another. Because "Happiness" is so vague, we don't reign it in as much, allowing people to have their own subjective views, although there are certain large principles that get near-unanimous support.