The short answer is that you do not need to add any additional time-invariant variables to the standard two-way fixed effects (TWFE) model. The treatment indicator $D_{it}$ already captures the key variation needed to identify the treatment effect, as it retains the characteristics of the standard differences-in-differences (DiD) interaction term. Furthermore, $D_{it}$ can be coded flexibly to account for different types of treatment variation, including situations with on/off or intermittent treatments, without introducing additional time-invariant variables. While these pulsating treatment exposures, where units alternate between treatment and control, have received limited attention, I have recommended solutions for these settings and linked them in the comments.
There, the $post$ indicator from the standard DiD-setting is captured by the time fixed effect $\gamma_t$, and the $treatment$ indicator is captured by the unit fixed effect $\lambda_i$.
This is technically correct. The fixed effects will absorb each variable in isolation, but the treatment variable $D_{it}$ will remain. The classical difference-in-differences interaction term cannot be neatly estimated, as "post-treatment" is not well defined. Moreover, units can switch statuses over time, returning to the control group, which suggests fluid group membership.
In the case I described above, however, there is variation in the treatment indicator because one unit might be a treatment group for the first event, but can be a control group for the latter event.
No problem.
Let $D_{it}$ equal 1 whenever a unit is in a post-treatment period, 0 otherwise.
How is the TWFE model supposed to look like in such case?
The model should look very similar to the one you suggested. Simply add a parameter to $D_{it}$, and you have a generalization of the difference-in-differences estimator, like this:
$$
y_{it} = \lambda_i + \gamma_t + \delta D_{it} + u_{it}.
$$
Should I just add the treatment indicator to the standard TWFE model like so $y_{it}=\gamma_t+\lambda_i+D_{it}+\mu_{it} + Treat_i$?
No.
The time-constant variable $Treat_i$ would be absorbed by the unit fixed effects in the model, making it impossible to estimate its effect separately. This is because the fixed effects already account for all time-invariant characteristics of the units, including treatment status, which is assumed to remain constant for each unit. In your setting, group membership (whether or not a unit is treated) is not well-defined over time, which adds to the confusion.
The key point is that in fixed effects models, the variation you’re trying to capture comes from within-unit (or within-group) changes over time. The product term you’re referring to—which captures the interaction between the unit and the time variable—is implicit in the way you code the treatment indicator $D_{it}$.
To clarify, $D_{it}$ is a binary variable that takes the value of 1 if the treatment is in effect for unit $i$ at time $t$, and 0 otherwise. This effectively captures the treatment effect without needing to explicitly define a product term or interaction term in the traditional sense. If a unit switches between treated and control conditions over time, $D_{it}$ can switch accordingly (from 1 to 0 or vice versa), reflecting these transitions within a unit(s). In this way, $D_{it}$ serves as the interaction term, encoding the time-varying treatment status for each unit (note the $i$- and $t$-subscripts), and it can also capture the reversal and resurgence of treatment over time.