You raise quotes the required amount, but never lower them.
\documentclass{article}
\makeatletter
\NewDocumentCommand{\mathquotes}{m}{% #1 = subformula to be quoted
{\mathpalette\mathquotes@{#1}}%
}
\newcommand{\mathquotes@}[2]{%
\begingroup
\sbox\z@{$\m@th#1#2$}%
\sbox\tw@{\normalfont``}%
\ifdim\ht\tw@>\ht\z@
\dimen@=0pt
\else
\dimen@=\dimexpr\ht\z@-\ht\tw@\relax
\fi
\raisebox{\dimen@}{\normalfont``}\box\z@\raisebox{\dimen@}{\normalfont''}%
\endgroup
}
\makeatother
\begin{document}
\[
\mathquotes{a}+\mathquotes{\frac{1}{2}}
\]
\end{document}

Here's a version where \mathquotes*
uses single quotes.
\documentclass{article}
\makeatletter
\NewDocumentCommand{\mathquotes}{sm}{{% #2 = subformula to be quoted
\IfBooleanTF{#1}{%
\mathpalette\mathquotes@{{`}{#2}{'}}%
}{%
\mathpalette\mathquotes@{{``}{#2}{''}}%
}%
}}
\newcommand{\mathquotes@}[2]{\mathquotes@@#1#2}
\newcommand{\mathquotes@@}[4]{%
\begingroup
\sbox\z@{$\m@th#1#3$}%
\sbox\tw@{\normalfont#2}%
\ifdim\ht\tw@>\ht\z@
\dimen@=0pt
\else
\dimen@=\dimexpr\ht\z@-\ht\tw@\relax
\fi
\raisebox{\dimen@}{\normalfont#2}\box\z@\raisebox{\dimen@}{\normalfont#4}%
\endgroup
}
\makeatother
\begin{document}
\[
\mathquotes{a}+\mathquotes{\frac{1}{2}}+\mathquotes*{A}
\]
\end{document}
