Having an unhealthy childhood appears to lead to changes to parts of the brain which have been linked with dementia.