Now, I found a post showing a much better solution (because this is the native way to do it) only using the Bureaucracy Plugin in template mode. No need for Javascript! (Following the rule to use JS only as a last resort.)
I dug this out: asheenlevrai Maybe, it helps ...
BTW, the dynamic method of using placeholders in the bureaucracy action code line, in general, is documented here: https://www.dokuwiki.org/plugin:bureaucracy#template_mode >> Method 2
sfitcs adapts this concept to select one out of two available templates. (In your case, your dependent fieldsets collect additional data into dataentries while your template is addressed by a placeholder, later populated by one of these anticipated dataentries (yesno), so-to-say, in expectation of their later population.)
I agree, this could become very complicated. If you add more choices down the line (in your form), you may end up getting huge numbers of possible combinations, again, this could be tackled with Javascript by selectively hiding any unused sections on your resulting page depending on previously injected flag headings, see concept above.
Cheers!