I think Paul MAY (only MAY) have been inspired to write this song by a controversy that was raging strongly at the time (late 67, thereabouts). It was rumored that the Pope (Paul VI) was going to relax the ban on "artificial contraception" for Catholics. The pill had begun to be very widely used following its introduction a few years earlier. One of the arguments used by Western women was that they could decide on the size of their families. They could have the number of children that they could look after properly, rather than breeding the family into poverty.
At the time, it was an often-discussed matter. Non-catholic christians were into the debate as well, because many saw the pope as being an important moral spokesman. The morality of the "pill", family size, poverty, ethial decisions made my people (priests) for whom there were no practical consequences, etc etc all were in the soup. Paul distilled ONE angle out of the debate, and produced one of his finest set of lyrics. It was seen by some as being a religio-political statement (really!).
THAT could be the religious angle to the song, if it has one. The "madonna" in Lady Madonna is NOT the "virgin", but rather woman-kind in general.
The Pope --of course -- said no way Jose! You gotta wonder what goes on inside the heads of these celibate heroes: not much, it seems.