Said another way, there was a breakdown between brand and product.
What is a brand exactly?
In it's most basic form, a brand is a promise. It's a signal telling consumers what they should expect from any products that fall under a given brand name.
As an example, let's use Tide. What are the things you expect from Tide as a brand? You probably think of stain free, clean clothes. Perhaps you think of the scent of clean laundry when it's coming out of the dryer.
When branded products stop living up to a brand's promise, the equity of that brand can erode. Consumers may be willing to forgive once, but overtime they will start to adjust their expectations for the brand, and that adjustment will result in a loss of loyalty.
Your Name is Your Brand
In the case of Casual Vacancy, J.K. Rowling took a huge leap from the expectations set by Harry Potter. She went from a middle grade story filled with magic and whimsy, to an adult novel set squarely in the real world, dealing with real, and often heavy, issues. Any reader who purchased Casual Vacancy with Harry Potter expectations was bound to be let down because of the drastic differences between genre and target age group.
Does this mean that Casual Vacancy shouldn't have been published? Hell no. She's J.K. F*cking Rowling. She can write whatever the hell she wants. But for the rest of us, our publisher, editor and agent will want stories that leverage our existing fan base, and readers will hold you to the expectations set by previous books you've written.
This doesn't mean you can't write a middle grade story and later write an adult story. But there will need to be shared traits between your MG and adult stories, such as genre, that links to your overall brand promise. Otherwise you might get push back from your publisher and agent, or they may request that you publish the story under a pseudonym.
No matter what, you should always write what you love. But be mindful of the expectations you will set from those early works - if you are lucky enough to have a fan base, your fans will want to see future products from you that mimic what they loved so much about your earlier works.