I’m not sure what you mean by the latter - b/c in this case the community definitely exists, so “creating” it if the ID were to ever not be found would lead to… well, it could have lead to exactly something like this, actually? Also, would you really want to pull in posts from a community that doesn’t already exist on a PieFed instance? Why even, especially if nobody has asked for it? So maybe instead of find_or_create, just a find_or_ignore?
But I have zero experience with ActivityPub, federation, or even much threaded-style programming, so I will leave such to you experts to puzzle out the actual solution!:-)
But please remember that in order to enjoy such diversity of opinions as you mentioned… we must become intolerant.
To the intolerant. There is no faster way to shut down conversations than to allow bullies to dominate everything within their reach.
So long as conversations can be kept “fun”, there will naturally be many more to follow, but when they cross the line, then fun-time is over and the people go home. Unfortunately, modding efforts are in short supply here - not as limiting as content creation, but still a constraining factor.