Dune in particular was so dominated by mysticism and
politics that I think it would have worked better as
fantasy set in ancient Egypt.
I've never thought of this. Strongly agree. I've grown a distaste for science fiction because often it's a lot more elaborate than it needs to be to communicate a point. It trades away the benefit of a completely fictional setting in thatScifi requires you to invest a lot of energy in the read, yet a lot of it is rubbish so the ratios are wrong.
Part of the reason I like Philip K Dick is that for the sort of fiction he writes, science fiction often is the best medium for communicating. And, he doesn't mind producing books where part of the story doesn't even make sense in a rational sense, so long as it's progressing the message.
In _Time Out of Joint_ the game world is implausible. The messages on paper doesn't make sense. The brainwashed characters seems like a big thing to be taken for granted. The edge of the world doesn't add up. However, the protagonist's attempts to come to terms with the world he's in is believable.
Dick writes fiction as I seek to hack. "Am I solving the problem I care about?"
The benefit of the lack of context is that scifi can serve as a literary equivalent of a rapid development environment. The author is able to summon technology or magic in order to create settings that exercise the characters. _Ubik_ uses not-subtle examples of this in order to explore the ideas it cares about - precognition and a variation of brain-in-the-vat.
Unfortunately, the mainstream culture of fiction and fantasy epic (Lord of the Rings, Dune) actively fights this flexibility. They try to construct castles in the air - worlds that take significant energy to build and comprehend, and which thereby become limited by the same barriers that affect tales set in real settings. Having done all this work, many then tell stories about princesses, knights and dragons. Dune managed to rise some way out of that.
And "summon technology or magic" is where a lot of bad sci-fi fails. Magic can have ridiculously arbitrary rules attached, but technology has to work systematically. If you add technology but omit all the effects it obviously should have had on your society (especially on other technology), readers like me are going to quit in disgust.
Well, except that some of it is. I get the impression that what you're calling pulp includes all the sensawunda, which is all that really separates science fiction from other genres (since other than that, most science fiction is in another genre... fantasy, western, mystery, thriller, etc -- including Dune, actually).