Nodes
If you have a regular image texture, you can recreate the ramp node with other nodes.
So we have an image with a gradient along it's length and we need to remap it's length, so X coordinate, to the intensity of some other image. It's possible to do that with nodes:

I needed to reverse direction with the invert node.
Color Ramp node with Python
If the color gradient is generated by script, why not output the colors to the Color Ramp node instead of an image?
bpy.data.materials["Material"].node_tree.nodes["ColorRamp"].color_ramp.elements[0].color
That's the first color of my test Color Ramp node that I have in "Material". Apparently it's easy to add new elements to the ramp as well: bpy.data.materials["Material"].node_tree.nodes["ColorRamp"].color_ramp.elements.new(0.5)
Use autocomplete function(Tab) in the Python console to easily find how things work in the Python API:

.
. Then, inside this material node tree, create a color ramp node. Then you can reference this color ramp node in the template inside your addon. Does that make sense ? docs oh and you can directly edit the material color ramp in your example too $\endgroup$