Depends on your perspective. Would it be fine for Meta Threads to replace it? Threads supports ActivityPub, so in some ways it likely interacts better with the fediverse.
If we agree that Threads isn’t a suitable replacement, then clearly there’s some criteria a replacement should meet. A lot of the things that make Threads unpalatable are also true of Bluesky, particularly if your concern relates to the platform being under the control of a corporation.
On the other hand, from the perspective of “Twitter 2.0 is now a toxic, alt-right cesspool where productive conversations can’t be had,” then both Threads and Bluesky are huge improvements.
Giphy has a documented API that you could use. There have been bulk downloaders, but I didn’t see any that had recent activity. However you still might be able to use one to model your own script after, like https://github.com/jcpsimmons/giphy-stacks
There were downloaders for Gfycat - gallery-dl supported it at one point - but it’s down now. However you might be able to find collections that other people downloaded and are now hosting. You could also use the Internet Archive - they have tools and APIs documented
There’s a Tenor mass downloader that uses the Tenor API and an API key that you provide.
Imgur has GIFs is supported by gallery-dl, so that’s an option.
Also, read over https://github.com/simon987/awesome-datahoarding - there may be something useful for you there.
In terms of hosting, it would depend on my user base and if I want users to be able to upload GIFs, too. If it was just my close friends, then Immich would probably be fine, but if we had people I didn’t know directly using it, I’d want a more refined solution.
There’s Gifable, which is pretty focused, but looks like it has a pretty small following. I haven’t used it myself to see how suitable it is. If you self-host it (or something else that uses S3), note that you can use MinIO or LocalStack for the S3 container rather than using AWS directly. I’m using MinIO as part of my stack now, though for a completely different app.
MediaCMS is another option. Less focused on GIFs but more actively developed, and intended to be used for this sort of purpose.