# How to explain the degrees of freedom of the t-test in lm() output?

I am doing a multiple linear regression where the predictors are two categorical variables: Time (3 levels) and Treatment (3 levels). The lm() results are:

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)      -1.6227     0.2627  -6.176 1.14e-06 ***
TimeT2           -0.3453     0.3941  -0.876 0.388383
TimeT3           -0.9509     0.3941  -2.413 0.022628 *
TreatmentTR2      1.9081     0.4736   4.029 0.000389 ***
TreatmentTR3      1.9485     0.3941   4.944 3.23e-05 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.7882 on 28 degrees of freedom
Multiple R-squared:  0.5163,    Adjusted R-squared:  0.4472
F-statistic: 7.471 on 4 and 28 DF,  p-value: 0.0003159


In the table the t-test p-values are calculated using the estimated t-value with t-distribution of df=n-k-1. In my data, the total number of observation n=33, number of parameters k=4. So all the t-tests above use the identical df=28.

However, if I just think about the t-test for the purpose of comparing the mean of these two groups after adjusting other covariates, for instance TimeT2 vs TimeT1(ref). I would imagine that the observations from T3 are not relevant for this t-test, thus, the df would only be calculated by the number of observations from T1 and T2 and k=1.

Think it in another way, if my purpose is to compare pairwise means of multiple groups and I have three groups with large difference in n (n_T1=10, n_T2=10, n_T3=200), conducting a pairwise t-test between observations from T1 and T2 only would end up with much lower df, as compared to looking at the t-test result in the lm output. In the separated t-test, we end up with df=18, while lm gives df=217. Isn't the lm t-test deflates the p-value?

Thanks