Meghan Trainor dealt with mental health challenges after welcoming baby No. 2 in 2023.