We could even say that mental illness is defined by falling significantly out of alignment with the median mind of society. A mentally healthy person in our modern society might be seen as completely insane and unwell in a hunter gatherer tribe.
But we generally don't get to work out who was just mentally ill with no value and who was a value add until well after their death.
"Society honors its living conformists and its dead troublemakers."