Hi,
The problem comes from the fact that the intersection point of the the two curves (spline1 and
bottomlengthspline) can NOT be the point given to the breakCurve() method. It is not explained in the documentation but looks to be that.
I was able to split it with the following two changes in you code (as for the first breakCurve() call):
# (...)
spline1_mid_point = xfind_closest_point_on_spline(spline1, midpoint_x, ui)
app.log(f'{spline1_mid_point.asArray()=}')
#=====================================================================
# CHANGE #1. choose the spline1's mid fit-point like so:
#=====================================================================
spline1_mid_fitpoint = spline1.fitPoints[spline1.fitPoints.count // 2].geometry
app.log(f'{spline1_mid_fitpoint.asArray()=}')
# Get sketch points
sketchPoints = sketch.sketchPoints
sketchPoint = sketchPoints.add(spline1_mid_point)
apex_height = .03
# Create an ObjectCollection for the spline points
bottomlengthsplinefitPoints = adsk.core.ObjectCollection.create()
# Add points to the ObjectCollection with correct z-coordinates
bottomlengthsplinefitPoints.add(adsk.core.Point3D.create(spline1_mid_point.x, spline1_mid_point.y, spline1_mid_point.z))
bottomlengthsplinefitPoints.add(adsk.core.Point3D.create(spline1_mid_point.x, .35954113, .54831595 + apex_height))
bottomlengthsplinefitPoints.add(adsk.core.Point3D.create(spline1_mid_point.x, first_point.y + .7, spline1_mid_point.z-.075))
# Create the spline that passes through the points in the ObjectCollection
bottomlengthspline = sketch.sketchCurves.sketchFittedSplines.add(bottomlengthsplinefitPoints)
#Break curve at midpoint
#=====================================================================
#CHAGE #2. provinding spline1_mid_fitpoint to the breakCurve() like so:
#=====================================================================
bottom_split_result = spline1.breakCurve(spline1_mid_fitpoint, True)
bottomcurve1, bottomcurve2 = bottom_split_result
app.log(f'{sketch.sketchCurves.sketchFittedSplines.count = }')
# (...)
And this is the result:

Then you script fails again in the following call to breakCurve(). You have to make the changes on those too.
Regards,
Jorge Jaramillo