I dunno. If the federation came across a space faring species enslaving others by pretending to be their gods I think they would act against the Goa'uld.
Like in this meme the prime directive would stop them from talking to the primitive humans on the planets but they would totally have beef with Apophis and co who are obviously warp capable and where the prime directive doesn't apply.
This is essentially how the Klingons originally worked. They would enslave weaker and/or less advanced planets and make those people produce raw materials for the Empire. It was very imperial/feudal/mercantilist.
The prime directive seems more like an excuse rather than a philosophy most of the time. The prime directive gets reinterpreted harder than the prophecies from Nostradamus.
The problem is that the Prime Directive as presented in Star Trek is shown as this fully formed dictate without anyone having a good idea as to why it is important. It is made worse with Star Trek's episodic form that doesn't go back to previous worlds to check up on them; Lower Decks makes it a point to show that the Federation is really bad at this.
In contrast, Stargate has a few episodes which show how such a policy would be good for the program.
I love that one episode in Atlantis with the "strategy game" in the Atlantean computer for this. Arguably one big difference is that the Tau'ri were always closer in tech to the places they visited than the Goa'uld et al.