Break conditional branches into separate methods

This breaks the two branches of the `if reflection.last` and `else`
to clearer see where the two methods can be refactored. Eventually
we hope to remove the need for these separated methods altogether.

Move the first branch outside the loop

This code doesn't need to be in the loop because it it always affects
the last chain. `get_bind_values` and `add_constraints` must match
in this context because `get_bind_values` is the caching of `add_constraints`

Use each_cons to remove need for `chain[i + 1]`

The `chain[i + 1]` is confusing because it's not immediately obvious
what it's trying to achieve. The use of `each_cons` makes it clear
we need to get the `next_reflection`.
Merge pull request #16762 from eileencodes/refactor-add_constraints-complex-loop-conditional

Refactor add_constraints complex loop conditional