TNG was close to having a transgender episode, “The Outcast”, but they were stuck in their time and didn’t really make any kind of statement.
TOS made several comments on religion and running into powerful beings. In particular “Who Mourns for Adonais?”, which would’ve been a great take if not for Kirk saying “Mankind has no need for gods. We find the one quite adequate”.
It wasn’t with no regard. They were deliberately giving minorities power over majorities and splitting ethnic groups with borders to fuel conflicts.