Sacred texts were written by men, who were inspired by God. From their level of awareness they wrote from their limited knowing. Our society is built on a patriarchal foundation of rules to have people conform. The quickest way to get someone to conform is to create a ferocious and angry God that would harm them if they don’t comply with the rules.
But that isn’t Truth. God is love. Each of us is made in the image of love. Whether we are straight, transgender, gay, black, white, brown we are all of God. If religion tells you that you are unworthy or a sinner that is not true. You are divinely made.