Issue was caused by from_memory=true passing to wm_homefile_read in case there's a configuration folder for current blender. But the thing is, we still might fallback to reading home file from memory (i.e. in cases there's no startup.blend in config folder). In this case we still need to run versioning code for userprefs.