On a more practical and aesthetic level, drawing cobblestone streets, cozy neighborhood stores, hand carved sandstone facade apartment buildings, etc is a lot more glamourous than drawing tract suburban housing, so I can see the appeal of it aesthetically. Also from what I've read about some of these authors, they were city people as well, so they just drew what they knew. The migration of the middle class to the suburbs didn't happen until many of these authors were well retired, so if kids are reading the more classic books, they'll see a bit more city life than usual and almost exclusively NYC where so many budding creatives had access to NYC's incredible publishing industry.
Lastly, kids can't drive. So if you want a kid having an adventure where he meets various storekeeps, neighbors out running errands, friends, pet stores, schools, etc then a walkable city makes the most sense. Walkable areas are just more communal and neighborly than suburban life as well. Its more realistic if a kid goes on an adventure in a city than in the suburbs were the only practical way around is being driven around. Bikes, less so, when the nearest store is 5+ miles away and there's no bike lanes. I also imagine parents are more comfortable with books not encouraging little kids to ride bikes in the street. As a parent, my recollection is that a lot of the books exist in a weird nebulous middle ground unless they outright take place in NYC or London or Paris for narrative reasons. Kids can walk through a urban downtown area with stores and neighbors but also end up in big suburban houses on big suburban streets in the same book and without taking a bus or a cab between either. So its probably hard to really divide this into city vs suburban if we want to be fair about it. Authors will do whatever fits their narrative. The walkable city is appealing but so is the big home, so why not have both?