Each Flatpak package has a unique ID in its remote. Librewolf is distributed as a Flatpak package from the well-known Flathub remote. The ID has not been migrated since the migration from Gitlab to Codeberg but it does not mean the package is on Gitlab, it’s on Flathub (and has never been on Gitlab itself).
It’s perfectly legal but personally, I would not find this really ethical: a lot of people don’t know F-Droid and if they find your application directly in the Play Store, they won’t know they can have it, the exact same application, for free but elsewhere.
I prefere one of those solutions:
Of course this is my point of view, everyone has its own vision of what is ethical or not. Do not take my comment as the absolute truth!