Your idea of replacing the pole p outside the unit circle (i.e., |p|>1) with a pole 1/p∗ inside the unit circle is correct. However, as mentioned in this answer, you need to be careful with the scaling. In order to obtain the correct scaling, a factor (z−p) in the denominator must be replaced by a factor ±|p|(z−1/p∗). In that way the magnitude of the transfer function will be unchanged on the unit circle, i.e., for |z|=1. This should also be added to the problem formulation:
... such that |G(z)|=|H(z)| for |z|=1.
Clearly, the new stable transfer function G(z) can be written as the original transfer function H(z) cascaded with an allpass filter A(z), since |A(z)|=1 for |z|=1:
G(z)=H(z)A(z)⟹|G(z)|=|H(z)|,|z|=1(1)
For the given problem, the transfer function A(z) is given by
A(z)=z−31−3z(2)