The Goblet of Fire film was tonally different in many ways too, like the angry Dumbledore while book Dumbledore was always friendly and supportive. Not that I would have known, having experienced it the other way around, but he was noticably acting out of character with no explanation. Could have been the best, the basis was there. Whacky, fun characters, a school ball, visiting students from different schools.
I don't know if some parts of the novels were written with a movie adaptation in mind, but what I recall having read is that Rowling specifically adapted some parts of the movies for her later books, like Alan Rickman's performance of Snape influencing how she wrote and imagined the character. The first movie came out after the Goblet of Fire book, and while negotiations for the rights to the books might have happened significantly earlier, dunno - well maybe Rowling thought she could get a movie adaptation after the runaway success of the Philosopher's Sorcerer's Stone, but that just complicates things unnecessarily. She's just not that good of a writer, and I suspect that, given the success of the books and films, her audience was not overly interested in class hijinks.
What is somewhat noticable is that plot elements keep popping up without much prior notice. I have honestly no ideas how much of the overarching story she had in mind while writing the early entries, but given how the series just keeps coming up with elements that should have always been a part of the universe but just never came up before, it cannot have been a whole lot. If I would want to be especially snarky it was fairly obvious that she didn't even have an idea how to finish the first book, and Quill just defeated himself by touching Harry. Because love. Okay, that is probably something specific to watching the film/reading the book as an adult, but that's a major asspull that never sat right with me.
Then there are the titular Deathly Hallows, retconning Harry's cloak and Dumbledore's wand into a group of three items that are only necessary so that Voldemort can inadvertently destroy the one Horcrux he did not intend to make without actually having Harry die in his final confrontation.
Not that Chamber of Secrets is free of asspulls, there is enough setup to explain how Harry survives his poisoning, and that the Sword of Gryffindor is enchanted to help brave Gryffindors in times of dire need, but there's zero indication that the Sorting Hat can just act as dimensional portal. Whee, enough of that before Hurlshot says I'm overthinking a silly fun fantasy series with magic (which is probably not wrong), but Chamber of Secrets is a good example that if everything else is good enough, a little plot hole or deus ex machina does not hurt one's enjoyment.
I was looking forward to reading The Order of the Phoenix because I expected it to explain the film and fill in gaps - what I got was a novel that I actively had to force myself through reading at times. It was easily the worst of the books, and inexplicably the one with the most pages, with a lot of them spent on going nowhere at all while Harry mopes around enough to get Gary Oldman killed. I guess I should really watch the film again after reading the book, it might really change my view of it.