[factory] add loader factory

(cherry picked from commit 7a8de8b42579425d269f42f3bf189183ff5c8eb5)