Back in late 1914, after a gathering of the TCBS, Tolkien decided to become a poet because the meeting helped him find "a voice for all kind of pent-up things".
Gradually, Tolkien wanted to find a connecting theme for all his poems, which he later wove into a larger story in early 1915. As a language enthusiast, Tolkien invented languages and the more he invented, the more he felt the urgency to create races of people speaking the languages and recording their history in poems.
After the war, in 1917, within a year of losing his two best friends and his experience in the ruthless war, he completed the basic settings for the stories taking place in the Middle-earth, as if "all his inspiration burst forth" henceforth, Ma says.