As a response to Chester Miller's comment:
The only assumption made is that we are dealing with a chemical reaction in a closed system of constant temperature and constant pressure. I think the point is that while $\sum_i\mu_idN_i$ is considered chemical "work", it's still not work that was done on the system by its surroundings. For this chemical energy, heat from the surroundings had to flow into the system (as we're assuming no other forms of work are done, except expansion-compression work), and it doesn't matter that it was converted to/used as chemical energy once this energy entered the system. So I would think the first law of thermodynamics is rather used for "influences" from the outside, and not from the inside (thinking of the system as isolated for a moment), in which forms of energy are converted. The first law is just a rephrasing of the law of conservation of energy anyways in a way that is useful for thermodynamics.
I don't know if all of what I'm saying makes sense, as I'm not sure I'm phrasing it well. But the point is that heat flew into the system, and had the quantity $TdS+\sum_i\mu_idN_i$. And the first law kind of tells us how this energy got into the system; either work was performed on the system or heat flew in. But as chemical work isn't work done on the system, but rather within the system, we don't "mind" (as far as the first law goes). The heat that flew in was still $TdS+\sum_i\mu_idN_i$, and part of it ($\sum_i\mu_idN_i$ to be exact) was used for chemical energy, and $TdS$ was just used for other forms of energy, that we don't take into consideration.
I'm guessing then that we could say
$$
TdS=Q-\sum_i\mu_idN_i.
$$
For spontaneous reactions ($\sum_i\mu_idN_i<0$) we would then have that $TdS>Q$, which could be interpreted as that the entropy first increases due to the heat transfer ($Q$), and then also increases due to the chemical reaction ($\sum_i\mu_idN_i$).
Disclaimer: I'm not feeling confident about everything, but at least I see some coherence this way.