lag times are a pain!
As you write, lag times influence the parameter values of the PK system quite a bit. Hence, the gradients wrt to the lag times are needed to my understanding; casting them away in C++ would be dangerous, I think.
So what you can do (this is in the archives of stan users), is to pass the tlag into the rhs of the ODE as a parameter. The rhs function then needs to handle the dosing event itself. Restarting the integrator at an unknown time is not possible, but you can just let the integrator handle the dosing discontinuity by himself. I know this is not ideal for the integrator, but the only solution I am aware of.
What I would attempt to do is to first fit a transit cmt Model first on some data which is informative about the tlag and then simply fix the lag and rerun with the full data. This is a hack, yes, but it should work. The transit cmt model can be written in Stan fully analytic, since you have all those nice gamma functions available.
I hope that helps. In case others have better ideas, I am very interested to hear these.
Best,
Sebastian