Certainly as others have said: the CPU and kernel both have their own self-preservation strategies.

I'll add some flavour concerning how yes uses computer resources.

It's worth distinguishing between the behaviour of BSD yes and GNU yes .

macOS is a BSD, so will use an (old) distribution of BSD yes .

A good discussion of the differences exists at How is GNU yes so fast?

And a discussion of that discussion exists on the Hacker News thread of the same name.