I'm reading Humphrey Carpenter's most interesting Secret Gardens: A Study of the Golden Age of Children's Literature, and I've reached the chapter on Kenneth Grahame. Carpenter identifies two poles of personality in Grahame, the Wanderer and the Home-lover, and says that all his writing was a product of the tension between those two, The Wind in the Willows being "the outstanding result of it".
Tracing the home-lover aspect, Carpenter refers to the many moves Grahame had to make during childhood and remarks,
"[they] must have played a part in his obsession with creating a snug, little home for himself, which runs through The Wind in the Willows (Mole End, Rat's bachelor home, Badger's splendid underground quarters) and may also be discerned in his early essays and letters. To a friend, he confessed that he had a recurrent dream of
'a gradual awakening to consciousness in a certain little room, very dear and familiar ... always the same feeling of a home-coming, of the world shut out, of the ideal encasement. On the shelves were a few books - a very few - but just the editions I had sighed for, the editions which refuse to turn up, or which poverty glowers at on alien shelves. On the walls were a print or two, a woodcut, an etching - not many ... All was modest - Oh, so very modest! But all was my very own, and, what was more, everything in the room was exactly right.' "
Also on the subject of Home-lovers and Wanderers, see this post.