Why are you trying to define the priors and the linear expectation in “one step”/incrementally? If you are worried about performance that’s misguided.
Defining a vector of beta priors (with shape=len(X)) and then taking the dot product with X to obtain y, will be much more efficient than a Scan based approach, and likely avoid and bracket nesting issues you’re seeing.
PyMC doesn’t run code in an imperative manner like that. The priors will always be defined as a vector (even with a Scan CustomDist) and then operated deterministically to calculate the logp. With Scan you have two disadvantages: you lose out on vectorization and your priors become interdependent, both of which will make things slower/harder to sample.
If you are concerned about memory allocations, I don’t think Scan will be better either.
Scan is only really needed for timeseries/ recurrent structural dependencies.