Evolution does not inherently require a positive result for something to be selected for. It simply has to tend to get replicated rather than not is all.
I wonder how many people these days remember that “meme” is a term coined by Richard Dawkins to support his (IMO very plausible) evolutionary explanation of the pervasive spread of religious belief in spite of its being often detrimental to the people who hold it.