There's certainly room for more research here, but some of them do attempt to account for other socioeconomic factors.
It's worth noting that surgery isn't the only option. Hormone therapy has also shown to reduce suicide risk, which is more accessible across socioeconomic strata.
There's a meta-analysis here: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC10027312/