This question has been answered by multiple community members. See the first response.
The only way around that that I can think of is to rewrite the Login snippet to write the referer to a $_SESSION variable if the referer is not the Login page. Then change the forwarding code so that if the Login succeeds and the current referer is the Login page, it redirects to the one in the $_SESSION variable.
The Login code is notoriously labyrinthine. I'm not sure, but I think the part you want is in core/components/login/controllers/web/login.php at line 94, rather than in the snippet itself.
That's definitely worth a try. I thought of it but, for some reason, thought it wouldn't work. I can't remember why I thought that.
$_SESSION['CallingPage'] = $_SERVER['HTTP_REFERER'];
$modx -> setPlaceholder('thepage', $_SESSION['CallingPage']);
[[!SaveReferer?]] [[!Login? &loginTpl=`lgnLoginTpl` &logoutTpl=`lgnLogoutTpl` &errTpl=`lgnErrTpl` &logoutResourceId=`5` &redirectToPrior=`1`]]
Are you reaching the Login page by following a link to it? If you just preview it from the Manager or type in its URL, the referer won't be set correctly.
Also, are you testing for a resubmission or the $_SESSION variable already being set in your preHook? In those cases the $_SESSION variable shouldn't be set. Otherwise, it will get overwritten when the form is submitted.
[[!SaveReferer?]] [[!Login? &loginTpl=`lgnLoginTpl` &logoutTpl=`lgnLogoutTpl` &errTpl=`lgnErrTpl` &logoutResourceId=`5` &redirectToPrior=`1`]]