How does playing with other children help a toddler's mental health?

Social engagemement. Social engagement cannot start early enough, provided the toddler isn't overwhelmed with too many people or other similar sensory overload. Humans are social animals, and toddlers, we hopefully desire, will grow into people who work and play well with others. This only can take place with supervision and practice, afforded by letting them play together a great deal.
Human beings are. social beings. Learning how to play with other children is part of the socialization process. Play teaches children to cooperate, show empathy, learn to take turns, and have fun with others. The sooner we learn how to get along with others the more positive our self image and mental health. We build self esteem, 1st with our families, then with friends.