Modified algebraic Bethe ansatz for XXZ chain on the segment - I: Triangular cases