I believe that should be possible. Like, I don’t see anything which would technically prevent this from working. Using program changes.
For this (play pattern B after 4 loops) you can simply use a modulo condition 4:4, which trigger only on the 4th loop.
Should be possible to go completely crazy with multiple probability-based program changes in a pattern as well… see here: Generative, mutating pattern chains