Apparently this bug has been known on English Wikipedia for a while and some of the more complicated templates have work-arounds for it. These workarounds are causing [[ https://en.wikipedia.org/wiki/Template_talk:Taxobox#Why_are_we_wrapping_the_infobox_inside_a_div.3F | problems ]] for the mobile site though, so we should fix the underlying issue (and create some unit tests for it).
To see this bug, compare:
The only difference between these two pages is that sandbox2 uses a template with 2 levels of transclusion and sandbox3 uses a template with 1 level of transclusion. In sandbox2, an extra linebreak is output at the beginning of the template, which changes the appearance of the article.