Inconsistent polymorphic results based on the input order
<!-- Before opening an issue: if you use `npm` try running `yarn` instead; if
      you run `yarn`, please try running `npx yarn-deduplicate && yarn`. -->

### Summary

I have an union type `union Animal = Cat | Dog` and a root field called `animals(input: [AnimalIdsAndTypesInput!]!): [Animal]!`. `AnimalIdsAndTypesInput` contains two fields called `id` and `type`. `type` can be either `CAT` or `DOG`. This field should return the cats and dogs in the same order as the input ids and types. However, depending on the order of the input array, it produces nulls for some extended fields in Cat.

### Steps to reproduce

1. Use the reproduction branch: [ouch-my-finger](https://github.com/achintha-weerasinghe/ouch-my-finger/tree/bug/poly-custom-sql)
2. Run the `schema.sql` file against the database to create the cat and dog tables and insert some dummy data.
3. Start postgraphile.
4. Execute the following `Query 1` and `Query 2`.

Query 1
```graphql
query MyQuery {
  animals(input: [
    {id: "2", type: "CAT"},
    {id: "1", type: "DOG"}
  ]) {
    ... on Dog {
      id
      name
      ownerName
    }
    ... on Cat {
      id
      name
      enemies
    }
  }
}
```

Query 2
```graphql
query MyQuery {
  animals(input: [
    {id: "1", type: "DOG"},
    {id: "2", type: "CAT"}
  ]) {
    ... on Dog {
      id
      name
      ownerName
    }
    ... on Cat {
      id
      name
      enemies
    }
  }
}
```
5. In the above two queries, the only difference is the order of the two input objects.

### Expected results

`enemies` of the `Cat` type should receive the expected JSON value.

### Actual results

`enemies` of the `Cat` type receives null.

### Additional context

I know the enemies field here can use a plan instead of custom sql execution. However, in my case it's more complex than this reproduction. Also, instead of `loadMany` I have tried `withPgClient` which returns no results, but an array of nulls.

When I said order of the fields, specifically this happens, when you put the extended type (in this case, it's the `Cat` type) later in the array of input objects.


