It's not "all in their head". If they don't meet society's expectations of them, then society will treat them very negatively (probably making them an outcast, if not a prisoner, depending on what happened). People in that position, in that society, take that step because they really don't have any good alternatives: society has forced it on them.
This is somewhat like saying "it's all in their head" when someone facing a life prison sentence commits suicide. Prison is essentially torture, so it's entirely rational to commit suicide if you have precisely two choices, spend the rest of your life in prison or kill yourself.