The code that OP has linked to is part of a convenience function for admins to add content to their new instances. It can query individual remote instances (e.g. lemmy.world), or it can query lemmyverse.net, and fetch communities that look to be popular and active.
It's completely unrelated to routine federation, and doesn't prevent anyone subscribing to communities that may have those words in their names.
The admin function could potentially be used to fetch hundreds of communities. It runs as a background process, so you don't know what they were until after they'd been followed. The "bad words" list acts as a safeguard against bringing in things you might not want or expect. One reason is that you may want to curate the first impression you give new visitors, as there as some that will be put off by the "fuck this" and "shitpost that" reddit-isms. Another is that you don't typically want communities that are disproportionately popular than others (e.g. if you bring in the default 25 communities, and one of is 196, then it completely dominate your front page).
If there's a particular community that you are interested in (e.g. because you moderate it), using this function isn't an efficient way to add it. In addition to the "bad words" filters, it will also exclude communities that are NSFW, or below thresholds for popularity and activity. Rather than fetching a bunch of communities at the same time, and hoping that the one you want is included, it's better to just add it manually (via a ! link or by using the "Add remote community" link) in much the same way as you would on any other platform.

It's mostly annoying me because it's affecting federation - not just the ability for new instances to backfill content, but for established instances to even be able to fully resolve a new post's details before the author nukes themselves. For example, the previous post (titled "Paranoia") isn't available on lemmy.ml or lemmy.dbzer0 because they would have been a few seconds "too late" to fetch the details for the author.
@lawrence@lemmy.world - if you'd like another mod to help out in the short term, I'm happy to volunteer. I realise people in the comments are being a bit defeatist about the ability to reckon with this problem, but whoever this person is should at least have to do a bit more work than they're currently doing.