Here is a general result on promoting identities for Lie groups from linear groups to all connected groups.

Let $\mathcal{LG}$ be the category of connected Lie groups and local isomorphisms ($=$ coverings) as morphisms.
Assigning to a group $G$ the topological space $G^m \times \mathfrak{g}^n$ defines a functor
from $\mathcal{LG}$ to topological spaces, with the property that it maps all coverings to coverings. It makes sense to ask for a natural subset $U(G) \subset G^m \times \mathfrak{g}^n$. In the example
from the original question, $U= \mathfrak{g}^2$,
in Tom's example, it is an algebraic set, but it could be the set of all $X \in \mathfrak{g}$ with $ad$-spectral radius bounded by $1$,
for example. Now let $(F_i)_G:U(G) \to G$ (one could look at maps $\to \mathfrak{g}$ as well, which is slightly easier),
$i=0,1$, be continuous natural transformations.

If you unwind this definition, $F_i$ is a function that is composed out of the data that are available for all Lie groups: the group operations,
the identity element, vector space operation and Lie bracket on $\mathfrak{g}$, the adjoint representation, all operations in the matrix algebra
$End (\mathfrak{g})$ (as taking power series, characteristic polynomials etc), the exponential map and taking derivatives of curves through the
identity element in $G$ (no attempt to make a complete list).

Theorem: ''With the above notations, assume that

$F_0=F_1$ holds for all linear groups.

$U(G)$ is path-connected for all $G$ (recall that I assumed all groups to be connected);

For each covering $H \to G$, the map $U(H) \to U(G)$ is surjective;

There exists a natural transformation $u:\ast \to U$ of functors such that $F_0 (u)=F_1(u)$ holds for all connected Lie groups.

Then $F_0=F_1$ is true for all connected Lie groups.''

Proof: ''Denote by $P(G)$ the statement that the Theorem holds for $G$. For each connected Lie group $G$, there exist, by Ado's theorem,
a Lie group $H$, a linear Lie group $L$ and coverings $H \to G$ and $p:H \to L$. Naturality and assumption $3$ show the implication $P(H) \Rightarrow P(G)$ and
the tricky part is $P(L) \Rightarrow P(H)$. Observe that $p \circ (F_0)_H = (F_0)_L \circ p_U = (F_1)_L \circ p_U = p \circ (F_1)_H$;
the second equality is assumption $1$. Therefore, $(F_0)_H$ and $(F_1)_H$ are both lifts of the map $(F_0)_L \circ p_U$ through the covering
$H \to L$. By assumption $2$, they have to coincide once they coincide at one point, which is the content of assumption $4$. qed.''

The proof makes clear that one can restrict to the subcategory of connected Lie groups whose Lie algebra is isomorphic to one of a fixed set $S$
of Lie algebras,
say $S=\{\mathfrak{sl}_2 (\mathbb{R})\}$.

The set $U$ in Toms example has at least two components: the boring one is $\{(0,0\}$ and other one contains those $(X,Y)$ that generate
$\mathfrak{sl}_2 (\mathbb{R})$ (this is probably connected). It is assumption $3$ that fails for this component.

The proof also shows that the target of the transformations $F_i$ can be more generally any functor from $\mathcal{LG}$ that maps local
isomorphisms to coverings.