Layer after Resume reverses direction (down, should move up)

What is the problem?
After a pause/resume (sent via the octoprint menu), the nozzle gouges the print because:
a) it resumes correctly and then on the start of the each successive layer moves LOWER instead of rising one layer.
b) Resumes at a position lower than where it paused.

I've tried a few things, but to no avail. So am looking for suggestions.
Everything aside from the position of the nozzle post-resume seems fine. After which it is either moving down to some arbitrary lower position, or is thereafter moving down for every layer when it is supposed to be moving up for each new layer.
Either I am doing something stupid in my gcode, or I have an issue with marlin (my configuration or a bug, but it seems unlikely I am the only person noticing this if it's the latter).

What did you already try to solve it?
[here: a) and b) correlate with a) and b) above.]
a) Previously uses a simple script that did not use any of octo's position remembering variables, and simply moved the nozzle up, and then down the same amount on resume. (not included, but I can dredge it up if need be)
....insert numerous iterations and attempts ot figure out why resume fails....
b) Am now using a script adapted from these forums that does use octo's positional remembering variables. (as quoted below)

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, ...)
Version 1.3.11
Log position on pause is active
Raspberry Pi3
I am typically changing filament during this operation, but it happens the same even when I simply pause/resume to test (and don't touch the printer in between).

There was a time when I would pause prints by script-inserting M25 into the gcode, and then resume afterwards with octoprint, so I have had it working in that respect.... but that seems like aeons ago.

After print job is paused

;---OCTOPRINT-PAUSED---
{% if pause_position.x is not none %}
G91 ; XYZ relative
M83 ; E relative
G1 Z+1 E-0.8 F4500 ; retract, move Z up
M82 ; E absolute
G90 ; XYZ absolute
G1 X0 Y200 ;arbitrary absolute pos
M300 S2222 P300 ;beep
M300 S0 P200
M300 S2222 P300
{% endif %}

Before print job is resumed

;---OCTOPRINT-RESUME---
{% if pause_position.x is not none %}
M300 S2222 P300 ;beep
M300 S0 P200
M300 S2222 P300
M83 ;E relative
G1 E-0.8 F4500 ;prime nozzle
G1 E0.8 F4500
G1 E0.8 F4500
M82 ;E absolute
G90 ;XYZ absolute
G92 E{{ pause_position.e }} ;reset E
M83 ;E relative
G1 X{{ pause_position.x }} Y{{ pause_position.y }} Z{{ pause_position.z }} F4500 ;return to paused position XYZ
{% if pause_position.f is not none %}G1 F{{ pause_position.f }}{% endif %} ;reset feedrate
{% endif %}

Marlin config

Configuration.h.zip (54.9 KB)