I wouldn't say that religion is founded on ethics. It's founded on
*doctrines* which might include some moral codes. Religious laws tell a
religion's followers to follow all sorts of rules, and some of them may be
disgusting, especially when you put something from thousands of years ago in
a modern context.
As a simple example, Jewish religious law treats women as property. The
punishment for rape of a woman, for example, is that you have to pay her
father some amount of money and then marry her; effectively, a "you break it,
you buy it" type of system. Not particularly unusual for the time, but you'd
be hard-pressed to find anyone in the West who would support this today.
In truth, religious people cherry-pick the parts that they like out of their
respective religious texts, and they use confirmation bias to affirm that
their religion is the basis of morality. When they find something that
contradicts their belief that their religious text is a source of morality,
they either find an excuse (such as claiming that it was supposed to be a
metaphor), or they use doublethink to correctly dismiss it as just a product
of the time it was written while still believing that the religious text is
generally a source of morality.