One psychological operation critical for emotion is the network of brain regions that underlie valence (feeling pleasant/unpleasant) and arousal (feeling activated and energized).
Not only does this include physical contact with the garment(s), but also includes arousal by printed material or electronic material that includes underwear.
Infants and toddlers usually experience confusional arousals beginning with large amounts of movement and moaning, which can later progress to occasional thrashings or inconsolable crying.