even if that means sacrificing your own happiness
Children are not better off growing up in a household where the parents hate each other, even if they are trying to stick together for the child's sake.
Resentment builds in that situation, naturally. Mental health goes down the toilet. You want children raised by two deeply unhappy people?
All that will teach them is to stay in unhappy relationships and tolerate toxic behaviour, because that will likely happen.
If you are willing to foist your unhappiness
You would absolutely be foisting your unhappiness on them if you stayed in a relationship instead of getting divorced. Do you think parents that want to divorce are just going to be happy? You can't fake happiness. Or at the very least, you can't fake it 24/7 for that long. If you're bottling emotions eventually that bottle is going to explode. There will be one hell of an atmosphere.
Should someone stay in a relationship after one cheats?
Ultimately, what you suggest will only lead to toxic atmospheres where everyone fucking hates everyone they live with.