I think there some subtleties in your question. 1) extent to which duration is built into your tx & target causal contrast (i.e. is it 1 pill / 1 therapy session?) & 2) how you are/n't using repeated outcome scores -- but generally if duration is a true consequence of your treatment, don't adjust
E.g. if a treatment decreases # clinic visits, that is part of the effect.
Regarding 2, there are some decision wrt correlated measurement errors & mediation beautifully explained via augmented DAGs in this paper: https://journals.sagepub.com/doi/abs/10.1177/0049124119826155
Back to (1). If duration is truly not important itself and it is only a matter of repeated exposures (and outcomes), you might consider a pooled structural model with lagged treatments and outcomes (for which IPW-ted marginal structural models were explicitly designed)
Comments
Regarding 2, there are some decision wrt correlated measurement errors & mediation beautifully explained via augmented DAGs in this paper: https://journals.sagepub.com/doi/abs/10.1177/0049124119826155