Core: Fix script fields to be returned as a multivalued field when they produce a list.

This change is essentially the same as #3015 but on script fields.

Close #8592