$$\max_{x_1}f(x_1,g(x_1)).$$ And, let $f$ attends max at $x_1^*$, so first order necessary conditions imply that $$\dfrac{\partial f(x_1^*,g(x_1^*))}{\partial x_1}+\dfrac{\partial f(x_1^*,g(x_1^*))}{\partial x_2}\dfrac{d g(x_1^*)}{dx_1}=0$$ and as my text says "If the differential function $f(x_1,\dots,x_n)$ reaches a local interior maximum at $(x_1^*,\dots,x_n^*)$, then these hold simultaneously: $$\dfrac{\partial f(x_1^*,\dots,x_n^*)}{\partial x_1}=0;\dots;\dfrac{\partial f(x_1^*,\dots,x_n^*)}{\partial x_n}=0 ",$$ first order necessary conditions also imply that $$\dfrac{\partial f(x_1^*,g(x_1^*))}{\partial x_1}=0$$ and $$\dfrac{\partial f(x_1^*,g(x_1^*))}{\partial x_2}=0.$$
Am I right?