I understand that である is most commonly used to replace だ/です at the end of a sentence in written expressions.
But outside this usage, I can't find much explanation on how to use this structure. In most cases, it seems to be interchangeable with の、のを、だった etc.
From what I can infer when reading a lot of example sentences, である means “as being” “exist as” “is”, I'm not confident with this interpretation though.
母が弁護士であることを誇りに思う。I'm proud that my mother (exists as) a lawyer.
であることを can be replaced with なのを
自分が一人であるのに気づく。I realized that I live alone. (exist alone)
であるのに can be replaced with なのに
子供の頃嫌いであった食べ物が、大人になって好きになるという話をよく聞く。I often hear that you grow to like food you hated (exists as hated) during your childhood
であった can be replaced with だった
編集者と出版社である人は私のいとこです。The editor and publisher (exists as) is my cousin.
である can be replaced with の
彼はフランス人であるに違いない。I'm certain that he's (exists as) French.
である can be omitted
これは赤ペンだ。黒いペンでもある。This is a red pen. It's also (also exists as) a black pen.
でもある cannot be replaced here
With this understanding, I tried to make my own sentence and I don't understand why it's wrong:
お金持ちであることは幸せな人生を送るわけではない。Being (existing as) a rich person does not mean you'll lead a happy life.
How does である work in these situations and what does it mean?