Thanks for the example. I now understand that you're talking specifically about portable infoboxes created by Lua - it wasn't clear from your original post.
Bottom line, you've indeed spotted a problem - portable infoboxes generated by Lua aren't rendered on the mobile skin (see some more technical details below).
I would say it's not very surprising. There are three different extensions involved: PortableInfobox, Scribunto and MobileFrontend - all three do complex parsing of content. Probably best you can do is file a report to Fandom, but I doubt they'll prioritize it.
Now a few technical details for anyone interested:
I've copied your example code to Dev_Wiki:Sandbox because there's no way to view user pages in the mobile skin.
I've tested two versions of it:
https://dev.fandom.com/wiki/Dev_Wiki:Sandbox?oldid=207658&useskin=fandommobile - an exact copy of your code example.
https://dev.fandom.com/wiki/Dev_Wiki:Sandbox?oldid=207659&useskin=fandommobile - to make sure that the issue isn't about which infobox comes first or the number of infoboxes (generally, the FandomMobile skin does treat the first infobox in a page differently than the others).
Another point to note is that the issue isn't with the JavaScript but with the original HTML generated on the server. Infoboxes don't need JS to be displayed, the JS just does some extra refinements. The error you're seeing is the JS trying to access the non-existing infobox, but no change in the JS can solve the issue.