Let $G_1 \subset G$ be Lie groups and $\mathfrak{g}_1, \ \mathfrak{g}$ the corresponding Lie algebras. Assume that there is a non-degenerate bilinear form $\langle \cdot, \cdot \rangle$ on $\mathfrak{g}$, which is $\operatorname{Ad}_G$-invariant and which is again non-degenerate, if viewed as a bilinear form on $\mathfrak{g}_1$.
Is it now possible to find a Lie algebra homomorphism $\pi \colon \mathfrak{g} \to \mathfrak{g}_1$, such that $\pi|_{\mathfrak{g}_1} = \operatorname{id}|_{\mathfrak{g}_1}$? If so, how do I prove the existence? Is it already enough to assume that $\langle \cdot, \cdot \rangle$ is $\operatorname{Ad}_{G_1}$ invariant?
The fact that the bilinear form is $Ad$-invariant implies that $\langle [x,y],z\rangle +\langle y,[x,z]\rangle =0$. This implies ff $g_1$ is an ideal, its orthogonal $g_2$ is also an ideal. If moreover $g_1\cap g_2=\{0\}$, the projection onto $g_1$ parallel to $g_2$ realizes $\pi$. In general $\pi$ does not exist as shows the comment of YCor.