The function f(x), without the restriction, is defined everywhere but at x = 1. The restriction allows you to ignore the division-by-zero problem at x = 1.
Then you're plugging f(x) into g(x). But g(x) is defined everywhere, while the restricted f(x) is defined only for 3 < x < 7. So you can't say that g(f(x)) is defined everywhere, because you're stuck with that restriction on f(x). If you can't plug, say, x = -5 into f(x), then you can't plug x = -5 into g(f(x)); it's still not an allowed input value.
So you need to look at the restriction explicitly placed on f(x), and then also check to see if, by composing functions, any additional restrictions are added.
. . . . .
The only additional restriction, to avoid dividing by zero, would be x = -1, but that's not in the domain of f(x) anyway. So the domain of g(f(x)) remains just the domain of f(x).
Hope that helps!