If the tax deduction was not factored in, the limit would be lower than 28%. It factors in everything. Cost of food, clothing, transportation, entertainment, and yes, taxes too. It factors in everything that isn’t principle on the loan, interest on the loan, property taxes and insurance.
It’s not a precise calculation. It is simply a percentage that historically works.