'Good' writing can mean a number of different things. Creating a gripping plot, believable settings, rounded characters. There's good basic English, but some writers use language in a more experimental or imaginative way. I read a lot of literary fiction, but I loved the HP books because I found them gripping and relaxing to read. I think it was clever to use tropes like boarding school stories, orphaned child, etc which people find familiar and comforting from lots of other children's books. I agree that some of the later books needed more editing. I've always wondered if editors got a bit scared of JKR when she became very successful and let stuff go that probably needed extra work.
It's true they are not Booker Prize quality writing, they're not innovative or stylistically challenging, and there are a few mistakes and sections of poorer writing. But prize-winning literature is often difficult to read, not always gripping or relaxing, and doesn't appeal to the vast majority of readers.
If JKR is a bad writer, probably most published novels are badly written too. I've read some trashy crime, romance, fantasy and other genres, and they were mostly by successful writers. There's room for all kinds of writing - if someone enjoys a particular genre, why should anyone turn up their nose? There are all kinds of benefits to reading, not just the intellectual challenge of reading great writers. Even reading so-called 'bad' writing can expand your vocabulary and fluency in spoken and written English. But reading is also about relaxation, losing yourself in another world, de-stressing, and it can increase concentration and focus. It's a huge achievement and takes a lot of skill/talent to get millions of children (and adults) engrossed in reading and to create characters and setting that are now part of our culture.