Use Gcode Extrusion Speed in Calculations
I don't think you're going to find either a firmware feature or a slicer feature that handles specifically what you want to do. The slicer would probably be the best place to put it, and I'd recommend maybe opening a feature request ticket with Ultimaker, because that sounds like an awesome feature.

That being said, there's nothing stopping you from post-processing your GCode file after it's been generated. If you're experienced with python at all, that's the place I'd recommend you start.

You'll probably want to do it via the following:


Find the first line number that does a retraction.
Sum up all the extrusion distances between that line and the starting point (the beginning of the file)
Replace the retraction distance and feedrate with whatever your short/medium/long retraction settings are
Store that line number as your new starting point
GOTO 1.


If you're using Slic3r, there's actually a post-processing script function built into the app itself, you just need to write the script and give it to the application to make the whole process hands-off. For other slicers you'll probably just have to run the script manually between slicing and printing.