How to realize the R code in Stan

That seems to be the core of the problem. Stan is indeed incompatible with such a resampling scheme. Usually what people do in such cases in Stan is to find a way to parametrize the model such that invalid combinations are never considered. So if \alpha were parameters directly, you would model them as a simplex.

If \alpha are supposed to be a function of other parameters, you IMHO have exactly the same problem as in categorical/multinomial/dirichlet regression (where a simplex is also parametrized). The most commonly used approach is to create a new set of parameters \bar\alpha where \alpha = \mathrm{softmax}(\bar\alpha). However, there is an identifiability issue here - there are infinitely many \bar\alpha that give the same \alpha after the softmax approach. The easiest solution is to fix \bar\alpha_1 = 0 and put predictors only on the other elements. The only disadvantage is that now the first element is “special”. Alternatively, one can constrain the sum of all individual predictors on \bar\alpha to 0 (either via a soft or hard constraint, see the discussion at Test: Soft vs Hard sum-to-zero constrain + choosing the right prior for soft constrain )

Would that make sense in your model?