The basic idea is that serialization type should not be initialized when it is not needed. Same for the serialization version.
So do this here for AutoFile. CAutoFile remains in places where it is not yet possible.
The moved parts can be reviewed with "--color-moved=dimmed-zebra".
The one-char changes can be reviewed with "--word-diff-regex=.".
This is a backport of core#25285