As I read the law it does require the Swedish monarch to be at all times a member of the Church of Sweden:
Well there we go then. A British-Swedish personal union is practically impossible on legal grounds unless one can in communion with both the Church of England and the Church of Sweden at the same time. It also makes a Danish-Swedish personal union impossible as well unless one can be in communion with both the Church of Sweden and Church of Denmark at the same time.
I wonder if the laws are the same for the Norwegian monarchy.
I however was responding to the OP, which mentioned Japan. For your second paragraph, i don't think it works that way in Islamic monarchies. I can't think of a single case of an Islamic kingdom being inherited by or through a female.
I had thought it was that way too, but the Wiki seems to indicate that at least some of the Gulf monarchies have changed that rule:
Oman:
In the absence of a male heir, the reigning Sultan may nominate a brother or other male relative from amongst the descendants of Sultan Said bin Sultan.
This could mean either in the absence of any male heir (whether a son or a grandson through his daughter) the Sultan may nominate his brother or another male relative (again maybe directly descended through the male line or just any male whether through the male or a female line) descended from the Sultan who died in 1856.
Qatar:
The order of succession as the Ruler of Qatar is determined by appointments within the Al Thani family.
Kuwait:
The reigning Emir must appoint an heir apparent within one year of his ascension to the throne; the nomination must also be approved by a majority of members of the National Assembly. The Heir Apparent has to be at least thirty years of age on the date of his royal proclamation, of sound mind and the legitimate son of Muslim parents. The position of Emir is also traditionally alternated between the two main branches of the Al-Sabah family, the Al-Salem and Al-Jaber branches.
Bahrain:
Succession to the Bahraini throne is determined by primogeniture amongst the male descendants of Sheikh Isa bin Ali Al Khalifa (1848 – 1932). However, the ruling King of Bahrain has the right to appoint any of his other sons as his successor if he wishes to
The articles though are all unclear as to whether succession could go through a female to another male.
What would happen if there were no direct male descendants left is unclear, but since a lot of the monarchies seems to have the power to appoint pretty much whoever they want from within the ruling family to be the heir then it doesn't seem impossible that one of those emirs could appoint a grandson who happens to be the son of his daughter and the son of a ruling emir from another country.