Why does thermodynamics only apply to macroscopic systems at equilibrium?
The mathematics of equilibrium systems are far simpler than others

It isn't strictly true that thermodynamics doesn't apply to systems that are not at equilibrium only that the simple theorems and formulae of equlibrium thermodynamics only apply to systems at equilibrium.

The reason why most discussion and most teaching is about those equilibrium systems is because the mathematical results are far simpler and far easier to teach. They are also widely useful even with systems that are not exactly at equilibrium. Chemists can understand the key features of many reactions, for example, by understanding the equilibrium thermodynamics of the reaction (like the heat of formation of the products). Exceptions can be explained by understanding kinetic barriers in the reaction pathway.

But when details of non-equilibrium behaviours are required, the behaviour of many systems is so complicated there are no easy rules to teach or to talk about.

Non-equilibrium thermodynamics is actually a very large field and key results have won Nobel prizes (Prigogine won the 1977 Nobel in Chemistry for work on key aspects of it). Arguably a great deal of the complexity of the universe and life itself is the result of the complexity and structures that can arise when systems are not at equilibrium. So you could even argue that our ability to understand any thermodynamics is a result of the complexity the can arise from non-equilibrium systems. If the subject is that complex, there are not going to be many simple formulae or generalisations to teach or talk about.

And that is probably the real reason why some people think thermodynamics only applies to systems at equilibrium: anything else is too complicated to talk about so educators and textbook writers tend to avoid the subject.