Hm, okay. I think there is a slight misunderstanding. After finishing a workout and saving the HKWorkout to the Health App it's immutable. You can not continue a HKWorkout after that.
With iOS17 the initializers of HKWorkout are even deprecated, you should always create a HKWorkout via HKWorkoutSession. You can read finished workouts (=HKWorkout) from the Health App but you aren't able to add anything to them. This goes for all samples you saved to the Health App. You can just delete but not edit them.
I think what you're trying to accomplish is to have a workout app with your own specific workout types and save them to the Health App. But for this you don't need HKWorkout. HKWorkout is now used by the Apple frameworks and you don't need to touch it. Perhaps some extension to it to get your custom metadata easier.
Please have a look at the documentation Running workout sessions how to start a workout.
When you want to link several workouts over more than one session you would need to store the data in the metadata of the workout event to identify them as a group.
Please bear in mind: You can have only one active workout session (=HKWorkoutSession) at all times. This means if you start a new workout session without ending the first one the first one is ungracefully killed.
I created a custom workout app and you can test it if you want. At no place in my code I create a HKWorkout on my own. I just add workout events to the current running workout (including some metadata for my custom workouts) to get the listings I need. What is more is, you can show the workout in the Apple Fitness app like any other workout done with the Apple workout app. Just without my custom data. This is shown in my own workout app.
And yes, the data model to create my workout plan with exercises and algorithms is completely custom. No HKWorkout was harmed in the process ;) On the other hand, exercising and tracking my workout is done on base of the above linked guide. For my done workout list I query the Health App and get back a lot of HKWorkouts which I then present with my custom metadata.