The last couple gold farm's I've made in Minecraft bedrock have had this same issue. The latest being this one here.
The first gold farm I made, using a similar design, back in early 2020 never had this issue.
What's happening is that while the gold farm is working fine in the overworld, mobs are spawning in (or traveling to) the nether as well. This mobs are immediately hostile the next time I travel to the nether, and can number in the several dozens depending on how long the farm was active in the overworld. This often resulted in being killed almost immediately as the zombie pigman start attacking before I even finish loading into the nether.
The nether portal I use to get to the gold farm is several chunks away from the farm, however it is the closest portal to the farm.
My temporary solution was to build a portal right under the gold farm, and an equivalent linked portal in the nether. On the nether side it's very close to the portal I normally use, but most pigman that spawn from the gold farm seem to be going through the second dummy portal instead. This portal is over a pit that keeps the hostile pigman in check. However it's not 100% safe as a few pigman are either spawning in the other portal as well or the hostile pigman are causing other spawned pigman to immediately become hostile and I'm still attacked as soon as I go through to the nether.
I have to make my nether-side portals above pits now to be safe, which is quite inconvenient. My next plan is to make a turtle egg trap near the portal to hopefully gather all nearby zombie pigman. But but this and the portal pits seem like bandaids and not solutions.
Any advice would be appreciated.