J.R.R Tolkien famously created his world and then created the stories he put in them. He was a professor, historian, and linguist by profession, and his writing style in The Lord of the Rings, The Hobbit, and The Silmarillion is very history-like. How much real experience did he have in writing before he began writing things in his world?
He wrote some (fiction) stories before LOTR, yes.
The Father Christmas Letters were written for his children, he wrote them pretending to be Santa.
Roverrandom, a children's book about a dog and a wizard.
Farmer Giles of Ham, a comical fable about a farmer.
He also wrote more stories after LOTR, in addition to a couple (non-fiction) research papers before that. So he wasn't entirely new to writing in general.
Tolkien started writing while on the Western Front. He wrote down his war experiences of the Great War down in Lost Tales according to his biography on the Tolkien Society. (Emphasis mine)
During these last few months, all but one of his close friends of the “T. C. B. S.” had been killed in action. Partly as an act of piety to their memory, but also stirred by reaction against his war experiences, he had already begun to put his stories into shape, “… in huts full of blasphemy and smut, or by candle light in bell-tents, even some down in dugouts under shell fire” [Letters 66]. This ordering of his imagination developed into the Book of Lost Tales (not published in his lifetime), in which most of the major stories of the Silmarillion appear in their first form: tales of the Elves and the “Gnomes”, (i. e. Deep Elves, the later Noldor), with their languages Qenya and Goldogrin. Here are found the first recorded versions of the wars against Morgoth, the siege and fall of Gondolin and Nargothrond, and the tales of Túrin and of Beren and Lúthien.
When the Armistice was signed on 11 November 1918, Tolkien had already been putting out feelers to obtain academic employment, and by the time he was demobilised he had been appointed Assistant Lexicographer on the New English Dictionary (the “Oxford English Dictionary”), then in preparation. While doing the serious philological work involved in this, he also gave one of his Lost Tales its first public airing – he read The Fall of Gondolin to the Exeter College Essay Club, where it was well received by an audience which included Neville Coghill and Hugo Dyson, two future “Inklings”.
The Book of Lost Tales I & II were published after his death.