I do something 'creative' to achieve something like this in a course.
Using audiences or groups you could show/hide the activities, and then you have a final course completion activity (I use a label with them marking it as complete as a declaration).
The label uses a Restriction set to do some nested restrictions:
- Is a member of audience/group A AND has completed Activity 1 + 2 + 3 (or just 3 if 1 & 2 are already part of Activity 3's restrictions,
OR - Is a member of audience/group B AND has completed Activity 4 + 5 (or just 5, as above).
Then course completion is only set to show as completed once the label declaration is completed.