Yes, it's a child's "confidence" as well. But, it's not the only thing.
It's also a child's "coping" abilities...being she has gone through so much with your separation, and now being back together, and now her being in a class with unruly boys...that is a LOT for a child to have to adjust to in one whole swoop.
My girl is like that (well=liked, hyper-aware,hyper-sensitive,very perceptive since a baby)...except that she is not passive and she is very expressive at home and with us. In her class, it's full of unruly boys AND girls...but her Teacher is a 20 year "veteran" and so all the "punk"kids are in her class. I don't think it's fair to my girl and all the other "good" kids...but. BUT, I MAKE SURE that I speak to the Teacher and make sure that my daughter's learning/happiness/and interactions are not "abused" by these kids. AND, my girl is not afraid of them.
Has your girl ever been bullied, or victimized, or picked on, or teased, or yelled at, or anything else "cruel"???? By anyone??? This can also DRASTICALLY change a child and make them "shut down." Usually, if a child regresses and shuts-down, and fears speaking or expressing themselves... It is usually a GREAT indication that something is really wrong...not just a confidence issue. I would really really really explore other issues she may have, or other problems that may have happened but which you know nothing about, because she does not communicate with you.
AND, I would suggest counseling for her... she is obviously, still affected by your separation and now back-together status. A child does not know it will last... they often will feel un-nerved by it... and perhaps that it could happen again...thus their "future" is not stable. It's unstable. For a child, any kind of "divorce/separation" is like a MAJOR trauma and "grieving" even. She must feel like a yo-yo.
AND, what are HER TEACHERS saying?????? You also need to start there. Any problems that they notice??? Just because a child is quiet, it does not mean they are happy. Your girl is obviously not "happy" now. It's good there is no upcoming "baby" or another child right now... your daughter NEEDS more of you and Hubby right now.
**Also, can you try and get your daughter into another class? If her current classroom and those unruly boys are affecting her negatively and "damaging" her psychological "health"...I'm sure you could use some persuasive "Parent" tactics and tell her Teachers/Principal that it is "damaging" your daughter and therefore you want her out of that class. There is a fine line.... and I for one, if this classroom atmosphere was causing my child psychological trauma and difficulty... I would advocate for my child and make appeals to the school/Teacher. There is no reason, that a bunch of trouble-maker children should take precedent over other children, and therefore "bully" the other kids or make them alienated. This is not education... this is catering to the trouble-makers.