Oddity when copying and modifying SKUID page XML via SOQL / APEX

I’ve found a way to get around this, though it’s odd that I need to do it this way.

Instead of splitting at 131071 to save 131071 characters in each Layout field, if there is a space at position 131071 or 131072, I back up the split point until there is no space next to the split point. This means potentially less characters can fit into a SKUID page, but the difference is negligible and shouldn’t affect what I’m trying to do. The page seems to work with an intelligently moved back split point.