I'm not really sure why you think that this only applies to frameworks and libraries. In my eyes this applies to any unit tested code. It is really hard or near impossible to test tightly coupled code. Or do you disagree about testing code in general?
Also I don't really understand why you think that factories are an antipattern. As I see it factories play an important role when using dependency injection.