In principle, you can create any shape and run it along a curve. Sometimes it is easier not to create a general solution for all possible cases, but to make a very special construction.
Have a look at these examples from the Collection of examples from discourse.threejs.org.
CirclesOnCurve
SineWaveGrooveRing
SpiralFromCylinder
Also dynamic.
Curved2Geometry