Sorta like how spontaneous and sudden changes can happen in dreams.
This could be her creative mind just making up songs to fit Seemed to be a well-known song in the Wonderland world)
Not only does Alice in Wonderland movie have many songs but also (This post is more something I noticed than anything else and so it’s pretty descriptive) Alantlm: Alan’s ALICE Appreciation Post: SONGS