The Japanese do seem to have gotten the habit of fetishizing youth, and have major nostalgia goggles for their good ol' school days. Or at least the Japan represented in anime does.
Having said that, "School" in anime is just a short hand for setting up a world, it quite rarely has anything at all to do with anything actually school related. It isn't any different than old fairy tales starting by a campfire told by an old wise man, or a greek myth being retold by a soldier that came back from a war. It's just an entry point used to put some familiarity and connection between us and the story. It is NOT what the actual story is about.
Given that most anime is indeed produced for those that are still in school, it's not hard to see why it's put in a location where... they generally are. It's a pretty standard way to put some connection between the viewer and the world the story takes place in. Conversely, you can use this as an argument that anime has indeed "grown up" a bit, as the shows from the 80's and the like used common aspects of childish fantasy to connect the viewer to the story, robots, space, little glorified soldiers, battles between super powered heroes among friends in the primary school yard and the like. While the story itself can be made entertaining to an adult, without a doubt, the connection point itself, the entry point is designed for the 8-year-old mind.
So in a sense, the medium got out of kindergarten and entered it's awkward puberty stage.

Give it a decade or two, and I wouldn't be surprised if it would shift into college.