Suppose that a King has two children A and B, where A is older than B.
Child A converts to Roman Catholicism before he has any children of his own, and child B then becomes the heir to the throne. Afterward, however, the Catholic child A has a child of his (or her) own and baptizes him (or her) in the Church of England. Does child A's child replace then child B as the heir ?
A related, and perhaps more complicated question: what if the King passes away and child B ascends the throne before child A has any children? Does the birth of a Protestant child of child A affect the legal position of child B as King?
The material sections of the Bill of Rights and the Act of Settlement are:
That all and every person and persons that is are or shall be reconciled to or shall hold Communion with the See or Church of Rome or shall professe the Popish Religion F3... shall be excluded and be for ever uncapeable to inherit possesse or enjoy the Crowne and Government [...]
And the said Crowne and Government shall from time to time descend to and be enjoyed by such person or persons being Protestants as should have inherited and enjoyed the same
in case the said person or persons soe reconciled holding Communion or Professing F4... as aforesaid
were naturally dead
https://www.legislation.gov.uk/aep/WillandMarSess2/1/2
A parliamentary briefing paper cites this explanation of the clause "heirs of the body" from Constitutional and Administrative Law, A Bradley and K Ewing, 15th ed, 2011, p234. (Note that it was written before 2015, the Succession to the Crown Act overruled the common law in regard to preference for sons over daughters.)
The limitation to the heirs of the body, which has been described as a parliamentary entail,
means that the Crown descends in principle as did real property under the law of inheritance before 1926. That law inter alia gave preference to males over females and recognised the right of primogeniture. The major exception to the common law rules of inheritance is that for practical reasons the right of two or more sisters to succeed to real property as co-parceners does not apply: as between sisters, the Crown passes to the first born.
https://researchbriefings.files.parliament.uk/documents/RP12-81/RP12-81.pdf
Therefore, given
(1) the statutory symmetry between the law of property inheritance before 1926 and the law of succession to the crown, and
(2) the treatment of Catholics and ex-Catholics as "naturally dead" for the purpose of succession to the crown,
the answer to your first question
"Child A converts to Roman Catholicism before he has any children of his own, and child B then becomes the heir to the throne. Afterward, however, the Catholic child A has a child of his (or her) own and baptizes him (or her) in the Church of England. Does child A's child replace then child B as the heir ?"
should be the same as the answer to the question
"Before 1926, Son A dies before he has any children of his own, and son B then becomes the heir to their parents' real property. Afterwards, however, Son A's widow gives birth to Son A's child. Does Son A's child replace Son B as the heir to the property?"
Likewise, the answer to your second question
"What if the King passes away and child B ascends the throne before child A has any children? Does the birth of a Protestant child of child A affect the legal position of child B as King?"
should be the same as the answer to the question
"What if, before 1926, a father passed away and son B inherited his property before predeceased son A had any children? Does the birth of a posthumous child to son A's widow affect the legal position of son B as owner of the property?"
Unfortunately, I can't provide the answers as I have not researched the English common law on property inheritance prior to 1926, but I hope that will be of help.