Background migration part for !3259 (closed) (depends on !3259 (closed)).
WIP: it's desirable to port the changes to background migrator infrastructure from !3213 (merged) (though not mandatory since current implementation is also in working condition yet has less features).