I was just reading Peter Green's Beyond the Wild Wood: The World of Kenneth Grahame, a biography of Kenneth Grahame with a particular focus on the relation between his life and his work.
There's no reason to doubt the basics of the standard origin story: that The Wind in the Willows was conceived as bedtime stories for Grahame's young son (as told in Elspeth Grahame's 1944 chapbook of letters, First Whisper of "The Wind in the Willows"). But Green explores a deeper psychological background. He views Grahame's animal world partly as a vision of idealised domesticity, an escape from his highly incompatible marriage (he described his mythos as "clean of the clash of sex"); and also as a reflection of a widespread upper-crust distaste at social changes at the close of the 19th century.
Grahame was a pastoralist, and a standard interpretation of TWITW is as metaphor for a very English nostalgia at the decline of a largely mythical Merry England: an unspoilt world of simple rustics and minor gentry, being invaded by trains, motor-cars and the proletariat, in the form of the vulgar weasels who temporarily take over Toad Hall. (In a BBC adaptation shown early in 2007, such rural landscapes were achieved by filming in countryside outside Bucharest).
TWITW enabled Grahame, already in ill-health - to retire from his job as a high-ranking bank official (he'd been fairly traumatised by a visitor to the bank - George Robinson, called "a Socialist Lunatic" in newspaper accounts, shooting at him). He wrote very little afterward, the end of his life further blighted by his son's suicide, officially reported as an accident despite unambiguous evidence of his deliberately lying on a railway line.
However, a number of authors, to varying degrees of acclaim, have revisited the Grahame mythos: Wiliam Horwood's The Willows in Winter, Toad Triumphant and The Willows and Beyond; Dixon Scott's A Fresh Wind in the Willows; and Jan Needle's Wild Wood. Most attempt to recreate the atmosphere of Grahame's books, but the last instead tells the events of TWITW from the left-wing perspective of the inhabitants of Wild Wood, whose lifestyle is poverty-stricken in comparison to that of Toad and his friends. The 1998 Counselling for Toads - a Psychological Adventure (Robert De Board, Routledge, ISBN:0415174295), although it looks a trifle didactic, is another interesting take in which Toad goes for counselling, using transactional analysis, to deal with the scripts he follows that cause his episodes of impulsive and obsessive behaviour.
Along with TWITW, a number of Grahame's earlier works are available from Project Gutenberg. There are several other biographies: check out Patrick R Chalmers, Eleanor Grahame, Peter Hunt and Alison Prince.
Addendum: the Telegraph feature Kenneth Grahame: Lost in the wild wood (John Preston, 08 Feb 2008) is a very good potted biography.
See also Something wild.