Can you spot any other ingredients in the mix that might be involved? I’ve run a quick check of both footnote types (inline/linked), positioned as the final text in a section, and do not run into any HTML containment errors like you demonstrate here.
This is my test project, maybe give that a look and see what I’d need to do to modify it to reproduce the bug, or send a snippet copy of your own project (you can DM me that to keep it out of the public forum, by clicking on my avatar and then the Message button). All I would need is one chunk in the binder that shows it happening, so a stripped down Save As copy of the project is fine, and would keep the project and compile settings intact.
final_footnote_bug.zip (28.5 KB)
This almost certainly is a side-effect of a fix we made to footnotes in 3.4, that resolved cases where empty lines in footnotes would end up printing those lines into the source text where the footnote came from, breaking paragraphs in half and so forth. So code that is stripping newlines might be a factor here if too much is being stripped in some scenarios.
Oh wait, I did just notice there is a problem with the final paragraph. It’s not a validity level problem according to ePubCheck and Sigil, but it isn’t good form. Basically the last paragraph is not a paragraph (<p>...</p>). So we should fix that, but it would be nice to have your condition in on the ticket as well, as they are undoubtedly related.