Another idea is to integrate out y and z from K(.) to get $K_x(x)$. You could then use $K_x(x)$ as the prior for g(x). If integrating out the prior is not possible then you have to follow John's suggestion.