The use of "beautiful = good" and "ugly = evil" is a standard fairy-story trope. This is why the spoiled prince gets turned into a hideous beast--since his soul is hideous--and only gets restored to his true form after he falls in love with a good woman who inspires him to be a better man. His outer appearance is made to match his inner disposition. It's the same reason that wicked enchanters may have pleasing appearances at the beginning of stories, but by the end they are usually stripped of this appearance and revealed to be hideous.
This is not simply a trope that makes stories easier for children to understand, but a fundamental understanding of the nature of reality. At the deepest level the Good and the Beautiful are transcendental properties of Being, along the the True and the One. They are interchangeable and differ only in notion. The equating of goodness and beauty is good metaphysics. Problems only arise if we make category errors, such as equating a beautiful appearance (category: quality, sub-category: shape) with a beautiful character (category: quality, sub-category: habit or disposition) and beautiful actions (category: action). But the possibility of category errors on our part does not a bad story make.
In his essay "On Fairy-stories," JRR Tolkien said the following:
Even fairy-stories as a whole have three faces: the Mystical towards the Supernatural; the Magical towards Nature; and the Mirror of scorn and pity towards Man. The essential face of Faerie is the middle one, the Magical. But the degree in which the others appear (if at all) is variable, and may be decided by the individual story-teller. The Magical, the fairy-story, may be used as a Mirour de l'Omme; and it may (but not so easily) be made a vehicle of Mystery.The equating of good characters with beauty and evil characters with ugliness, as well as the transformation of characters' shapes and appearances to match their inner dispositions is part of a fairy-story's use of magic to reveal to the reader something about nature.
Art is revelatory of being and this trope reveals the ontological unity of goodness and beauty. This is true even if such revelation is not something the author necessarily intended. Good characters are not good because they are beautiful, they are beautiful because they are good and fairy-stories often match inner disposition to outer appearance. Insofar as transformations are used to cause outer appearances to match inner dispositions, the trope shows that we should move past appearances to get to the truth. The evil enchantress may appear beautiful, but she is truly ugly. This ugliness is later revealed and made explicit by the lifting of a glamour, or by her transforming into a monster to battle the hero, or some other use of magic that reveals her true character through a change in her appearance.