Let me know if I missed anything, but I think what you asked is actually a result by C.Fefferman in reponse to "finiteness principle" if we do following observations.
Claim: As long as we proved some $\omega$-continuity for the Hessian $D^2h$ i.e. we have an extension $h\in C^{2,\omega}(\mathbb{R}^d)$, then the spectrum of Hessian will not oscillate too much in a small neighborhood in $\mathbb{R}^d$ of $C_M\cup C_N$ in form of $$\{ x\in\mathcal{R}^d:dist(x,C_M\cup C_N)\leq\epsilon \},\epsilon>0,dist(x,S):=inf_{y\in > S}d_{\mathbb{R}^d}(x,y)$$
This is true because following observations. The Hessian $D^2h$ is symmetric under your assumption, due to Hoffman-Wielandt Theorem, as long as the entries $\frac{\partial^2h}{\partial x_i^{2}},\frac{\partial^2h}{\partial x_i x_j}$ do not oscillate too much in the neighborhood, the spectrum of Hessian will not oscillate too much. Thus the positivity of $D^2h$ is preserved in such a neighborhood since $h$ coincide with $f\cup g$ on $C_M\cup C_N$ while $f\cup g$ is known to possess positivity in their Hessian.
But the entries will not oscillate too much in a small neighborhood of $C_M\cup C_N$ if $h\in C^{2,\omega}(\mathbb{R}^d)\subset C^2(\mathbb{R}^d)$ ($h$'s second derivative has $\omega$-continuity).
So it suffices to find such an $h\in C^{2,\omega}(\mathbb{R}^d)$.
Now yield the Theorem 1 of [Fefferman] by letting tolerance $\sigma\equiv 0$. I would like to hear your motivation if possible.
[Fefferman]Fefferman, Charles. "A generalized sharp Whitney theorem for jets." Revista Matematica Iberoamericana 21.2 (2005): 577-688.