build_constraint_matrix_and_vector refactor bugfix

We need to always use the proper qoi index, and we need to *not*
recurse infinitely while sucking up gigabytes of memory and freezing
Roy's laptop.