ive been thinking of this and never thought they put it in words like this before to be more precise rowling battled with depression for a long time dementors for instance symbolize depression thats why lupin gives harry chocolate after he encounters them also the ridiculous spell paralells how certain cbt types suggest using humor in defusing from intrusive thoughts