The Lord of the Rings grew out of J.R.R. Tolkien's story that he created to service his creation of a language. The whole legendarium was written to show how the language could evolve and spread and change through time. The fact that it ended up being epic fantasy is bonus.
Dune grew out of Frank Herbert's demonstration of the powers and limits of prescience, the dangers of religion and state becoming intertwined, and the unanswerable questions of free will versus determinism. The fact that it ended up being epic sci-fi is bonus.
What I mean is that the philosophy that some find boring is the heart of the story! The action is just there as a consequence of the philosophical ideas that are being explored.
Actually, if I remember 'Road to Dune' correctly it was the other way around. He started off with an outline for an epic sci-fi adventure tale and later developed it with some much broader themes.
There was also something about an incomplete article about using beach grass to halt sand dunes encroaching on farmland. I don't remember if that was the original impetus or what later made him shift towards the ideas of planetary ecology that ended up in the final novel.