Parse has_child query/filter after child type has been parsed

Fixes #5783
Fixes #5838