Increase spacing between custom \left and \prod & \sum

I slightly modified the spacing around \left and \right as described here.

\let\originalleft\left
\let\originalright\right
\renewcommand{\left}{\mathopen{}\mathclose\bgroup\originalleft}
\renewcommand{\right}{\aftergroup\egroup\originalright}


I like the look of the modified versions better in every case except when immediately followed by \prod or \sum. In that case, the spacing is too tight as shown below.

Regular left

Custom left

Code

\vec z_k \sim p_k(\vec z_k) = p_0(\vec z_0) \ \prod_{i=1}^k
\left|
\det \frac{\partial f_i(\vec z_{i-1})}{\partial \vec z_{i-1}}
\right|^{-1}.


Q: Is there a way to go back to the old spacing in only that case and keep the changes to \left and \right everywhere else?

The link you've found is quite old. The issue discussed in that link has given rise to the mleftright package, which provides macros called \mleft and \mright. In short, no need anymore to modify \left and \right by hand.

I would either load the mleftright package and use \mleft\vert and \mright\vert or load the mathtools package and use its \DeclarePairedDelimiter macro to create a macro called \abs (and, automatically, the variant macro \abs* which auto-sizes the "fences"). As the first two lines in the following screenshot demonstrate, both methods produce the same, i.e., tight-looking output.

Finally, to address your question directly: If you prefer the look produced by \mleft{<fence>} and \mright{<fence>} in most use cases, you could issue the instruction \mleftright at the top of the document; this makes \left and \right behave like \mleft and \mright by default. If you need to revert to the "standard" behavior of \left and \right, simply issue the command \mleftrightrestore; this also works locally, i.e., in a TeX group. E.g., something like this: \begingroup \mleftrightrestore \left\vert <stuff> \right\vert \endgroup. See also the third line of the screenshot and its associated LaTeX code. Alternatively, if for some reason you prefer not to employ the mleftright package and, instead, wish to use the code you posted in your query to modify the default properties of \left and \right, simply use \originalleft and \originalright to access the original [pun intended] workings of \left and \right.

\documentclass{article}
\usepackage{mathtools} % for \DeclarePairedDelimiter utility macro
\DeclarePairedDelimiter{\abs}{\lvert}{\vert}
\usepackage{mleftright}
\mleftright % make \mleft and \mright the default

\begin{document}
\begin{align*}
\vec z_k \sim p_k(\vec z_k)
&= p_0(\vec z_0) \prod_{i=1}^k
\abs*{
\det \frac{\partial f_i(\vec{z}_{i-1})}{\partial\vec{z}_{i-1}}
}^{-1} \\
&= p_0(\vec z_0) \prod_{i=1}^k
\left\vert % remember that behavior of \left and \right has been changed
\det \frac{\partial f_i(\vec{z}_{i-1})}{\partial\vec{z}_{i-1}}
\right\vert^{-1}\\
&= p_0(\vec z_0) \prod_{i=1}^k
\begingroup \mleftrightrestore % restore behavior of \left and \right locally
\left\vert
\det \frac{\partial f_i(\vec{z}_{i-1})}{\partial\vec{z}_{i-1}}
\right\vert^{-1} \endgroup
\end{align*}
\end{document}