Why not just extract a factor graph (these encompass both directed and undirected graphical models) from a Stan program? Ryan already has implemented the code to do this. Then you can visualize that. This is something that is always possible.
Moreover, it’s easy to check whether a Stan program is a generative model using static analysis. If so, we can give users the option to also visualize it as a DAG if they want. I don’t see the problem.
Not sure if it’s easy to check whether the program corresponds to an undirected graphical model. If so, then we can also allow people to visualize the models that way if they so desire.