Yeah, there are many variables. Because even with certain genetic factors, a person may not acquire a mental illness and even with certain environmental factors, a person might not.
It most definitely is not known exactly why a person acquires a specific mental illness when they do, while another in a similar situation with a similar genetic background or personal history, doesn't.
But it is absolutely false to state we don't know whether environment or genetics cause certain conditions in certain people.
PTSD is a mental illness. People do not get that without being exposed to trauma. Thus, using deductive reasoning, it is clear that PTSD is caused by the environment.
People who were sexually abused as children show exponentially higher rates of mental disorders such as depression, anxiety, personality disorders, suicidal ideation, and sexual dysfunction, than people in the general population. Thus, using deductive reasoning, we can determine that the environmental factor of sexual abuse caused the mental illness, at least in most cases of people with mental issues who were abused as children.
In regard to the statement that it is doubtful that children can be diagnosed with (or have) mental illness, wow, that's quite untrue. I'm sure the millions of parents dealing with serious mental disorders involving their children, would be happy if you were correct. My work has me dealing with the mental health field and children, quite frequently. Children are diagnosed and exhibit mental problems all the time. Children with mental illness are placed in locked facilities on a regular basis.
Here's one such case:
Born Schizophrenic - Jani's Next Chapter [1/5] - YouTube