Gollum is a worm, straight out of Ring of the Nibelungen, which Tolkien was fascinated with. Wotan, Sigfrid, everybody is in there. He barely changed the names, Gollum was originally Grendel.
I don't know where you've gotten your information, but my sources contradict you. In the Niebelungen Saga, there are NO "worms," only the Rhineland city of "Worms." Grendel does not appear in either the Niebelungen Saga or Wagner's epic poem. Grendel is the creation of an unknown Anglo Saxon writer who gave us the tale "Beowulf." Gollum, therefore, would not be based on Grendel (the monster in the "Beowulf").
Most likely, Gollum is based on the dwarf Alberich, father of Hagen, who first steals the ring from the Rhinemaidens, thus initiating the tragedy. Alberich, et al, are characters in the Nieblungen Saga and Wagner's adaptation of it.