Is there an advantage to doing it this way rather than defining separate models that just incorporate functions like priors and likelihoods? I would think doing it this way you run into all of the usual problems of using conditionals rather than object-oriented or functional programming.
PyMC is so much more flexible than Stan for this kind of thing, I’m surprised I don’t see it more often on this list. I’d be writing my models with functions or object inheritance all over the place for things like hierarchical priors or compound likelihoods.