A lot of results are available for the following chain-rule problem:

(**CRP1**) Let $f\colon \mathbb R \to \mathbb R$ be a $C^1$/Lipschitz function and let $g \colon \mathbb R^d \to \mathbb R$ be a weakly differentiable function (e.g. $W_{\rm loc}^{1,p}$ or $BV_{\rm loc}$). Then the function $f \circ g$ is weakly differentiable as well and explicit chain rule formulas hold, like for instance in the Sobolev setting
$$
(f \circ g)'(x) = f'(g(x)) g'(x)
$$
a.e. with respect to Lebesgue measure (with some standards caveat when $f$ is Lipschitz).

I am wondering for the other way round, i.e.

(**CRP2**) Let $f\colon \mathbb R \to \mathbb R^d$ be a $C^1$/Lipschitz function and let $g \colon \mathbb R^d \to \mathbb R$ be a weakly differentiable function (e.g. $W_{\rm loc}^{1,p}$ or $BV_{\rm loc}$). What can we say about the function $g \circ f \colon \mathbb R \to \mathbb R$? For instance in the Sobolev setting it seems to me that the formula
$$
(g \circ f)'(x) = \nabla g(f(x)) \cdot f'(x)
$$
(a.e. with respect to Lebesgue measure) makes sense, doesn't it? Are there any references about this topic?

Thanks.