I've heard this idea before, but I did not learn until recently just how many great writers operated on this philosophy—across time and place.
Seneca:
"Scorn the pleasure which comes from the applause of the majority. Many men praise you; but have you any reason for being pleased with yourself, if you are a person whom the many can understand? Your good qualities should face inwards."
Seneca cites Democritus:
"One man means as much to me as a multitude, and a multitude only as much as one man."
He also cites Epicurus:
"I write this not for the many, but for you; each of us is enough of an audience for the other."
Heraclitus, as cited by Diogenes Laertius in the Palatine Anthology, says:
"Why do you drag me up and down, ye illiterate? It was not for you I toiled, but for such as understand me. One man in my sight is a match for thirty thousand, but the countless hosts do not make a single one."
Julian the Apostate wrote in Misopogon:
"I often say to myself, like Ismenias—for though my talents are not equal to his, I have as I persuade myself a similar independence of soul—'I sing for the Muses and myself.'"
In the Essays, Montaigne says:
"And if no one reads me, have I wasted my time, entertaining myself for so many idle hours with such useful and agreeable thoughts?"
In Human All Too Human, Friedrich Nietzsche writes:
"Sibi scribere. — The sensible author writes for no other posterity than his own, that is to say for his old age, so that then too he will be able to take pleasure in himself."
Virginia Woolf in A Room of One's Own:
“So long as you write what you wish to write, that is all that matters; and whether it matters for ages or only for hours, nobody can say. But to sacrifice a hair of the head of your vision, a shade of its colour, in deference to some Headmaster with a silver pot in his hand or to some professor with a measuring-rod up his sleeve, is the most abject treachery, and the sacrifice of wealth and chastity which used to be said to be the greatest of human disasters, a mere flea-bite in comparison.”
Cyril Connolly said in The New Statesman (1933):
“Better to write for yourself and have no public, than to write for the public and have no self."
In a letter to Auden from 1955, Tolkien says:
"I wrote the Trilogy as a personal satisfaction, driven to it by the scarcity of literature of the sort that I wanted to read... I was not thinking much of the profit or delight of others."
Harper Lee in a 1964 interview:
"People who write for reward by way of recognition or monetary gain don't know what they're doing. They're in the category of those who write; they are not writers. Writing is simply something you must do. It's rather like virtue in that it is its own reward. Writing is selfish and contradictory in its terms. First of all, you're writing for an audience of one, you must please the one person you're writing for. Yourself."
Before the internet, writing for oneself was easier. The "audience" was so distant from the writer, physically and temporally, that "writing for oneself" was a simplification, relative to writing for an audience. Writing for an audience probably felt vexing and paralyzing, whereas writing for oneself would have felt more certain and reassuring.
In the era of social media, the situation is reversed. Now that audiences are so near, publishing words to please them feels easier than writing for oneself. Not to mention, "the death of the author" and other postmodern notions that would seem to obviate writing for oneself.
To write for oneself alone, one must now go far off the normal path—a certain degree of anti-social discipline and effortful re-cultivation is necessary to even have a self for whom one could write.
All of which reinforces my feeling that, indeed, this is the way.
Sibi scribere!