Visualising the Supernatural at Kunstmuseum Basel charts how spooks and ghouls in artworks reflect shifting anxieties about everything from technology to sex