I have recently considered whether coroutines introduced in C++20 would be up to the task of solving exactly the problem you describe: C++ coroutines instead of modal loops and async callbacks for UI?
Unfortunately my suggestion didn’t seem to gain much traction and the main answer was “don’t try to do that, use callback lambdas instead”. But your description of the problem above is far better and shows why callback lambdas don’t scale well for the case you describe.
In a complex flowchart, each branching would need to provide handling code for all further branching downhill from there, with possible joining paths afterwards, causing an unnecessary combinatory explosion of possibilities, duplication of code that makes it difficult to maintain, etc.
I don’t have time at the moment to dig further into the direction of coroutines, but it’s on my list to try and experiment with them for user interaction with JUCE UI
