Looking through HoME, Ungoliant is always given as having unknowable origins - some texts hint that she appeared in Arda when the Lamps were broken, but in the Book of Lost Tales something very interesting is said:
Quote:
for here dwelt the primeval spirit Moru who even the Valar know not whence or when she came, and the folk of Earth have given her many names. Mayhap she was bred of mists and darkness on the confines of the Shadowy Seas, in the utter dark that came between the overthrow of the Lamps and the kindling of the Trees, but more like she has always been;
|
And in the commentary:
Quote:
In the tale her origin is unknown, and though this element may be said to have remained in The Silmarillion..., by the device of 'Some have said...' a clear explanation is in fact given: she was a being from 'before the world', perverted by Melkor...The original idea of 'the primeval spirit Moru' is made explicit in an entry in the early word list of the Gnomish language, where the name Moru is defined as 'a name of the Primeval Night personified as Gwerlum or Gungliont'
|
This shows that the earliest intentions of Tolkien at least were to have Ungoliant as a being from outside Arda, maybe even to represent something which was not of Eru's making or control, as is suggested by 'Primeval Night'.
To me, looked at in this way Ungoliant is a truly amoral creature, something like a Trickster (though we also never see her take 'beautiful' form by way of charming those she meets). She is tricked into helping Melkor, via her greed (or maybe her needs?) but she shows him no allegiance. Ungoliant is a being from the older, darker Faerie.
Perhaps as Tolkien's legendarium developed there became less of a place for such an amoral creature so that eventually we were left only with vague hints of Ungoliant's true nature. Taking on board the idea that the stories were from the point of view of Elves and those on the definite side of 'Light', then there would not be room for a lack of a moral code in a creature, and there would not be room for a creature who was outside of the control or even creation of Eru.