I'm not sure if this is what you want, but it is not difficult to prove that if f and g are primitive recursive functions, then the set { (x,y) | f(x) = g(y) } is a primitive recursive subset of the natural number plane. That is, the characteristic function of this set is primitive recursive. The (trivial) reason is that the characteristic function is simply the composition of the characteristic function of equality with f and g. One can therefore have primitive recursive access to that set when defining other primitive recursive functions, such as the ones you will need in your commutative diagram.