MDL-40035: Avoid rebuild_course_cache always for empty course