Not sure I dig baking it into the code, that starts walking into the broken by design space. Feasibly the tankies developing Lemmy could do the same to any instance not painted the right shade of red.
I might propose instead a step in setup, or on demand, to select major instances to allow/deny federation from with a description of them. Impossible to keep a list of every new instance up to date, but catching the major hubs shouldn't be impossible.
Edit: For all those who replied along the lines of it being optional not a hard coded block, point noted. I should expect no less misleading a post from a pool of people prone to leaving out vital facts.
My understanding as it being an opt-out default defederation is still a bit grating since I tend to think of software as a neutral tool rather than promoting specific ideals, but it's far better than a fixed in state and does serve some purpose to shield new users from some of the most egregiously bad actors.