Build color ramp out of math nodes?
Unfortunately there is no way to create a group node exactly like the Color Ramp, where you can add and remove color swatches at will.  To get around this I have created a node with two movable swatches, you can then combine multiple of these nodes together to have the functionality of multiple swatches.



The theory:

The two input colors are plugged directly into a Mix RGB node.  The two Pos inputs need to be sent through a function and plugged into the mix factor.  The position of the first swatch needs to be mapped to $0$ to get just the first color out of the mix node.  The position of the second swatch needs to be mapped to $1$ to get just the second color out of the mix node.



The math:

Here's a graph to visualize what we are trying to do, on the x-axis is the input factor of the color ramp, on the y-axis is the desired output, $a$ and $b$ are the positions of the two swatches.



With some simple algebra we can find the equation of the line to be:

$$
y = \frac{1}{b-a}x + \frac{a}{a-b}
$$

The math nodes below are simply replicating this equation.  The final Add node also has Clamp checked to clamp the output to the interval $[0,1]$, which is what the mix node accepts.