There are people who write for themselves. These people write what they want, the way they want it and if you don't like it than that's just your opinion. Their work is often riddled with incorrect diction, punctuation and bad grammar. When anyone points those things out to them, they meant it to be that way to serve the story.
You've probably seen the singing equivalent of these people on American Idol. They're the ones that come into their auditions full of confidence because their parents/friends/church family have all told them that their singing is nice (usually because they don't want to hurt their feelings with the truth). When they are told the truth about their singing, they rationalize it by saying "That's YOUR opinion!" Naturally, we're talking about the opinions of experienced music industry professionals who have a pretty solid basis for comparison. Still, the contestant will walk away from the encounter confident in their belief that what they do is awesome even if the judges didn't like it. In my house we call these people, "Classically Trained Samurai" because there is now way in this century to become a "Classically Trained Samurai" (Look it up), yet there are people who insist that they are just that. Given that the samurai class in Japan was abolished in the late nineteenth century, these folks are Samurai in their own minds. They fight and/or practice for themselves just as some writers write for themselves. And often publish for themselves hoping that they will find other "Classically Trained Samurai" who are interested in the same kind of things that they are and will enjoy their work.
Then there are people who write for readers.
These are writers who very often make a ton of money, and write in whatever genre is popular at a given time. James Patterson is a perfect example of this. Wildly successful as a mystery writer, he then branched out into pretty much whatever genre/subgenre is trending; Wizards, Awkward Adolescent, Women's Fiction. Patterson at least credits his co-authors since no one person could possibly write this much fiction fast enough to take advantage of current trends. While I might initially be prone to sneer at this sort of genre chasing (not that crossing genres is bad, I write/read more than one genre too), Patterson is I'm sure making money hand over fist. There is also something to be said for pleasing the crowd, which he usually does.
I however, think that some of the best writing falls somewhere in between these two poles. We all choose what to write about based on our windows on the world. I for example and a history loving Southern girl who is also a Scotia-phile. So, I like to write about my roots in North Carolina and the history there and about Scots. The Once & Future Series that I'm working on is something that I'm writing for myself because these characters have been living in my head for years, and I would like for them to live on pages or screens for others to enjoy. But I'm also conscious of the fact that in order for others to enjoy the story, I have to be interested in their opinions. I need feedback from readers about the narrative and the style. Is it engaging? Is it easy to understand? Are the characters believable?
Every writer needs this kind of feedback and should seek it out, preferably prior to publishing. However, if you're true to your vision you'll take this feedback with a grain of salt. We writers have to pick and choose what changes to make. Keeping that choice in the hands of the writer is one of the great things about indie publishing. I can incorporate feedback that says "this needs more action and less Celtic myth nerd-dom". I can also say no to morphing my characters into teenage malcontent vampires at wizard school because someone says that YA Paranormal Romance is super hot these days. It's a balancing act that is essential if you mean to publish and actually sell books even if not as successfully as James Patterson.
With that said, I'll soon be sending out my latest piece of historical fiction to my beta readers to get that feedback prior to publishing. Since it's based on a true story, hopefully no one will ask me to change the ending.