Transfer the fix in #42131 to the typelayout lowering code. Noticed as part of investigating the fix for #60590.