I tried to dive into the musl do_glob() function, it would take too much time to pinpoint the issue myself.
I decided to report it in the #musl irc channel and after providing full strace outputs of both the working and not-working case, @dalias identified the issue due to the order of returned entries being different.