The word comes from Old French demeine, and there never was an s (so, the original s was in their heads). The word is first attested in "English" (French-English legal code-switching) without <s>, and with various spellings. The non-etymological s is the only s in the word demesne. T
hereThere are a number of words in French that used to have s, which was deleted, and it appears that orthographic <s> was added in these words to indicate that the vowel is long (and, I suppose, that the word is French).