The cells in my tables often contain expressions with superscripts. This results in a text baseline that appears to "wander" between adjacent cells. For example
\begin{tikzpicture}[every node/.style={minimum size=7mm}]
\matrix{
\node[fill=gray!10]{$a$}; & \node[fill=gray!20]{$a^2$}; & \node[fill=gray!30]{$b$}; & \node[fill=gray!40]{$b^2$}; \\};
\end{tikzpicture}
produces

I understand that the way to align the text of all cells to a common baseline is to use anchor=base, but this has the side effect of jumbling the cells. For example
\begin{tikzpicture}[every node/.style={anchor=base,minimum size=7mm}]
\matrix{
\node[fill=gray!10]{$a$}; & \node[fill=gray!20]{$a^2$}; & \node[fill=gray!30]{$b$}; & \node[fill=gray!40]{$b^2$}; \\};
\end{tikzpicture}
produces

Is there a way to align all text to a common baseline, without shifting the cells as well?
\documentclass[]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[every node/.style={minimum size=7mm}]
\matrix{
\node[fill=gray!10]{$a$}; & \node[fill=gray!20]{$a^2$}; & \node[fill=gray!30]{$b$}; & \node[fill=gray!40]{$b^2$}; \\};
\end{tikzpicture}
\begin{tikzpicture}[every node/.style={anchor=base,minimum size=7mm}]
\matrix{
\node[fill=gray!10]{$a$}; & \node[fill=gray!20]{$a^2$}; & \node[fill=gray!30]{$b$}; & \node[fill=gray!40]{$b^2$}; \\};
\end{tikzpicture}
\end{document}
