Man & Woman needed an answer to the inexplicable. What were stars, where did the Sun go at night etc When these things were unexplainable, it had to be because of a great deity in the sky. Therefore anything that was un explainable was because of the deity.
When someone had an unexplainable mental illness, this was against the deitys "teachings" and there for had to be the work of the devil. Remember an illness like Epilepsy has been recorded since the beginning of recorded history - in fact it means possess in ancient greek.
As with so many things in ancient superstition and the "holy" books science has superseded all that has gone before it, showing these superstions for what they are.
So yes performing an excorcism is evil because there is a physical reason why someone is afflicted and it isn't possession.