There are probably better ways.
\documentclass{article}
\usepackage{amsmath}
\usepackage{esint}
\usepackage{tikz}
\usetikzlibrary{shapes}
\DeclareRobustCommand{\oiint}{%
\mathop{}!%
\vcenter{\hbox{%
\makebox[0pt][l]{%
\sbox0{$\displaystyle\phantom{\iint}$}%
\makebox[\wd0]{%
\begin{tikzpicture}
\node[
line width=0.5pt,
draw,
ellipse,
inner xsep=-0.15ex,
inner ysep=-0.15ex,
] {\phantom{+,}};
\end{tikzpicture}%
}%
}%
}}!%
\iint
}
\begin{document}
[
\oint_{X} \quad \iint_X \quad \oiint_X
]
[
X\iint X
]
[
X\oiint X
]
\end{document}
The idea is to insert an empty mathop in order to get the right spacing before the symbol; then we insert a negative thin space because we add an ordinary symbol, namely the ellipse set to a zero width box that has inside it a box as wide as the integral, containing the ellipse. Next another negative thin space to cancel the one that's inserted in front of \iint. Thus limits will be appended to \iint.

\oiint? – samcarter_is_at_topanswers.xyz May 24 '23 at 13:44\documentclass{article} \usepackage{amsmath}to be compilable, I think. But to solve your problem: addanchor=base, baselineto the\tikzcommand, so that it becomes\tikz[anchor=base, baseline]. This adjusts the contents of the node to the baseline of the surrounding stuff. – Jasper Habicht May 24 '23 at 14:44