Restoring previous value of PGF/TikZ key?

Based on the comments by Andrew Stacey and PolGrab, you could create a style that achieves the effect you describe:

\tikzset{cells preserve inner sep/.style={
    cells/.expanded={
        inner xsep=\pgfkeysvalueof{/pgf/inner xsep},
        inner ysep=\pgfkeysvalueof{/pgf/inner ysep}
    }
}}

Then use it like this (the order is important):

\begin{tikzpicture}[every node/.style={draw}]
    \matrix [matrix of nodes, cells preserve inner sep, inner sep=0em] {
        X & Y \\
    };
\end{tikzpicture}

Result:

cells preserve inner sep


A re-arranged approach is:

\tikzset{matrix style/.style={
  cells/.expanded={
    inner xsep=\pgfkeysvalueof{/pgf/inner xsep},
    inner ysep=\pgfkeysvalueof{/pgf/inner ysep}
  },
  matrix of nodes, inner sep=0em
}}

\begin{tikzpicture}[every node/.style={draw}]
    \matrix [matrix style] {X & Y \\};
\end{tikzpicture}