How would I make a circuit that takes a voltage (V) as input and outputs min(V, Vref)?
It depends on how accurate you need this to be.  Here is a simple concept:



D1 and D2 provide the MIN function.  The voltage at the top of the diodes is the minimum of Vin1 and Vin2, plus a diode drop.  It should be obvious how to expand this to any number of inputs to take the minimum of.

D3 tries to compensate for the diode drop, so that Vout is the minimum of all the inputs with the diode drops cancelled out.  If within a few 10s of mV is OK, then this might do.

Vhigh and Vlow are voltages you have to supply.  Vhigh must be a bit higher than any input voltage of interest, and Vlow a bit lower.

The impedance of the input voltages need to low enough to overcome R1.  The output impedance at Vout is higher due to R2 needing to be high to not interfere with the signal.

That's the basic concept.

The next step is to realize that BJTs can be thought of as diodes with gain. Here is the same concept carried out with BJTs using their gain to advantage:



Look carefully and you'll see its really the same thing, using the B-E junctions of the transistors in place of the diodes in the previous circuit.  The advantage is that the input signals don't have to supply anywhere near as much current.  The B-E diodes still do the MIN function, but most of the current comes from the negative supply.

The gain is used the other way around so that the B-E junction of Q3 loads the signal much less.  Due to the gain of the transistors, this circuit has much lower output impedance while having higher input impedance.

One drawback of using the B-E diode of BJTs this way is that the max input range is narrower.  This is because the reverse voltage characteristics of the B-E junction is usually fairly low.  If you're only doing this over a 5 V range, then there should be no problem.  Of course, always check the datasheet of whatever transistor you plan to use.  Choose ones with high B-E reverse voltage capability if you want a wider input voltage range.