Partial no-op refactoring of #9948 This contains some prep work for #9948 to keep that change to the minimum, and make it easier to review it. This should be a noop, but it has some tests from that PR discussion, and should help in the future with the corner case format handling. cc: `@Alexendoo` `@llogiq` `@xFrednet` as the 3 people who reviewed the parent PR ---- changelog: none