"<<! BUG IN FGRAPH.REPLACE OR A LISTENER !>>" during mcmc sampling, but sampling finishes correctly

PyTensor, but it would be good if you could simplify it quite a bit and make it a standalone reproducible snippet