The part about helping others is a big factor. It gives a reason other than self, which seems to be a big factor.
It's hard to say what makes it "work" for certain. The Oxford Group, the predecessor of AA, lacked the helping others aspect and did not see widespread success. This is what AA itself considers to be their unique magic.
Or maybe it's all the sayings! God, there are so many sayings.
Despite being very hostile initially, I got a lot of benefit from 12 step programs. It is not something I have stayed formally involved with, but I got a lot of helpful insight.
I don't think any one thing did it for me, it was a long and difficult process. The fact I'm alive and stable today is a small miracle. Most people in the state I was aren't so lucky.
I know what doesn't work though: Shame. I had to stop shaming myself before I could get well.
https://www.cochranelibrary.com/cdsr/doi/10.1002/14651858.CD...
It will become non-paywalled (or should I say, non-semi-paywalled) come March over at https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7065341/
The current science shows that Alcoholics Anonymous is an incredibly effective treatment for many alcoholics. Indeed, the 2020 Cochrane Review on AA shows that Alcoholics Anonymous is more effective then other treatments in getting alcoholics abstinent. See https://www.nytimes.com/2020/03/11/upshot/alcoholics-anonymo... or https://www.wbur.org/commonhealth/2020/03/11/medical-science...
Keep in mind that Cochrane reviews are the golden standard for high quality meta analysis of science, as pointed out at https://en.wikipedia.org/wiki/Wikipedia:MEDDATE