The triangulation of the different shapes (sphere, cylinder, torus … plane surfaces) uses the same algorithm with only small differences due to the mathematical dependencies.
If you want to combine different shapes into an inner geometry, it is better to have only one function. This function then uses the appropriate mathematics for the geometry (normal, surface point …).
In addition to the triangulation functions, the construction of the matching fronts (boundaries, holes) causes a not inconsiderable effort. Currently approximately 1 to 1. If other forms are added (torus), the ratio shifts further.
Cylinders can be connected excentrically with tilt and have tilted caps.
A first example https://hofk.de/main/threejs/Triangulation/01_InnerGeometry.html
Use the slider.
another example https://hofk.de/main/threejs/Triangulation/02_InnerGeometry.html