Reading an essay by Andrew Brook and Christopher Young today reminded me of Schopenhauer's view of psychosis from The World as Will and Representation (vol 1; originally published 1818):
Now if such a sorrow, such painful knowledge or reflection, is so harrowing that it becomes positively unbearable, and the individual would succumb to it, then nature, alarmed in this way, seizes upon madness as the last means of saving life. The mind, tormented so greatly, destroys, as it were, the thread of memory, fills up the gaps with fictions, and thus seeks refuge in madness from the mental suffering that exceeds its strength.The position, as Brook and Young ably describe, is fundamental to Freud in Neurosis and Psychosis (1924), and intuitively compelling to boot.
In regard to the genesis of delusions, a fair number of analyses have taught us that the delusion is found applied like a patch over the place where originally a rent had appeared in the ego’s relation to the external world. If this precondition of a conflict with the external world is not much more noticeable to us than it now is, that is because, in the clinical picture of the psychosis, the manifestations of the pathogenic process are often overlaid by manifestations of an attempt at a cure or a reconstruction.This intuition that what makes for paradigmatic mental illness is itself a mental operation - but one which 'saves' the mind by severing that reality contact which makes for cogent mentality at all - is hard to hold on to. Many analyses of mental illness which focus merely on dysfunction take us nowhere near it. But it is, I believe, the fundamental, if buried, insight which structures the very notion of mental illness per se.
Feb 2021 update: Justin Garson has several nice examples of 'madness as strategy' as opposed to 'madness as dysfunction' in his 2019 book What Biological Functions Are and Why They Matter.