Red thread is used on babies to prevent 'mal de aire' - ill winds; amber or yellow coloured beads protect against 'mal de ojo' - the evil eye. It is often held that mothers should not leave the house with the newborn or have anyone other than family visit the newborn until the 'ombligo' belly button has healed to prevent evil spirits from entering the baby through this open wound.
My children had read thread bracelets with amber beads to protect them from mal de aire and mal de ojo and they were also gifted talismans made from ojo de venado seeds hung on a red thread with a yellow glass bead and a picture of the Virgin Mary stuck onto the seed too.
The cotton in ears is, I think, about protecting these entrances to the body through which damaging vibrations and ill words/sounds can enter when you are weakened and at your most 'open' through having the wound of the placental site unhealed.
Even as an adult, if you have hiccups on public transport people will hunt around for a red thread to make into a ball and stick on your forehead to cure you. Very odd especially when the stranger uses their spit to make the thread into a ball before offering it to you!