Goal
I am attempting to redefine an existing command (\mintedinline) which takes a verbatim argument. I need to format this argument such that it can be passed to an outside program for processing; this requires some minor string substitution to ensure that some characters such as double quotes are properly escaped. For the substitution, I am using the xstring package.
Problem
I have discovered that the \StrSubstitute{}{}{}[] command provided by xstring does not seem to work with verbatim arguments in general, not just in my particular use case. I suspect that this is do to the verbatim text being tokenized differently/completely detokenized, but I am not enough of a LaTeXpert to fully understand the inner workings of verbatim arguments.
Minimum Working Example
\documentclass{article}
\usepackage{xstring}
% How the command needs to be formatted for my purposes
\NewDocumentCommand{\mwecmdactual}{v}{
\StrSubstitute{#1}{a}{c}[\tmp]
\tmp
}
% A test case showing the expected output using a mandatory argument instead of a verbatim one
\NewDocumentCommand{\mwecmdexpect}{m}{
\StrSubstitute{#1}{a}{c}[\tmp]
\tmp
}
\begin{document}
Result of \verb+\mwecmdactual|abcde|+: \mwecmdactual|abcde|
Result of \verb+\mwecmdexpect{abcde}+: \mwecmdexpect{abcde}
\end{document}
Results
The above MWE was compiled with pdflatex, and a screenshot of the output was taken:
The screenshot clearly shows the failure of \StrSubstitute to perform the substitution when it is given a verbatim argument from an encompassing command.
Request for Help
I am unfortunately bound to using the verbatim argument as I am ultimately redefining a preexisting command. Thus, any solution would need to use the verbatim argument as it is provided via the \mwecmdactual|| (in reality the \mintedinline[]{}||) command.

