I'm not sure how federation does anything to prevent that from happening, though. They can still do that on your instance, from their instance.
At most, I suppose an instance could defederate from a troublesome instance that's doing this, but the more that happens, the more fragmented the Fediverse becomes, and it starts to defeat the purpose of federation in the first place.