MDL-59784 core: Modal factory should listen before fetching templates