Most congregations do not ask because if they learned about a specific problem, they might feel pressured to do something about it and that would probably include a confrontation.
Agreed, but not necessarily. If a member is leaving over a specific reason, I think in most cases it would be inappropriate to share that reason with the entire congregation. (Would lead to confrontation.)
However, if a trusted minister or a trusted elder were to ask the individual: "Is there something that happened that perhaps we could learn from?" then perhaps the person would like to talk about the incident and move forward.
I remember once when my son was 6 and was having trouble sitting still during a service, I took him out into the narthex so he wouldn't disturb the sermon. A man sitting in the pews followed us out into the narthex, and yelled at my son and told him he was not a child of God. My son was so startled he was crying his eyes out, and I wanted too as well. This man should have stayed in the pew and listened to the sermon and mind his own business, and let me handle my son. I did let that church's youth and families minister know what had happened, though. She said that was absolutely unacceptable. I don't know what the follow-up was, if any. But I was glad I had spoken up. (And I was especially glad that church was not our regular church - we were attending a multi-church service at a neighbouring church.) But maybe the info was shared discreetly with the ministry team.