As
@Gazebo said, deficit is explicitly not happiness. It is the amount of yields per citizen that you're missing. If the reduction was included in deficit, the buildings would need to say something like "reduces the required science per citizen by one" instead of "reduces illiteracy by one".
Deficit <value>: the number of yields missing per citizen, causing unhappiness for that need.
Up to <value>: the maximum possible unhappiness that need can have for this city (equals the deficit value without unhappiness reduction).
<value> from <need>: the actual unhappiness that need is currently producing (equals the up-to value unless the city has hit the max population unhappiness cap).
What else modifies "Up to"? I remember seeing it before the static happiness rework, but I guess that was before deficit was modified to "per citizen" from "total missing".
In this depiction, it's not clear in the UI where the building flat bonuses are applying. Let's accept that, without any building, the limits on unhappiness from needs is 50% of the city population. So, as the summation of all limits is less than half the city population, we must infere that the reductions are applied to the limit values. But this is not how we are told that unhappiness is calculated.
Let me use an extreme example. Consider that only distress exists as a need. In a 10 pop city, only 5 pop can suffer from distress, as designed. Suppose that our food yield is so low that distress could value 7, but it is capped at 5 due to city size.
It reads
*) Distress 5, Deficit 7, up to 5
Now we build a Barracks, giving -1 to distress.
How is it going to read?
a) Distress 5 , Deficit 6, up to 5
b) Distress 4, Deficit 7, up to 4
Gazebo says that the current formula works with case a, but at the UI it looks like it works with case b. If it works with case b, as it seems, then building bonuses are removing the dependency on yield efficiency, as Bite is claiming.
If we used case a, then happiness reductions from buildings won't be noticed when deficit is too much over the cap. In the given example, we need 3 distress reductions before the city loses 1 unhappiness, because deficit is so high. If we are using case b, then one single building bonus lowers unhappiness by 1 always.
This could explain also why happiness is so easy to handle in this iteration.