The answer you are looking for is hidden inside you own question: "there are a lot outside". The game randomly checks places to put mobs and since the outside is much larger than your trap, most of the zombie pigmen spawn there. The mob limit is exhausted pretty much instantly and the game doesn't spawn any more, unless some of the existing mobs de-spawn or get killed.
You will get zombie pigmen to spawn in your trap eventually, but you may have to wait hours for just a few spawns. You need to prevent spawning outside your trap to improve rates of your trap. This is very difficult to do in the nether, since you can't use light or water to prevent spawning. That is why you don't see zombie pigmen traps, building one is a monumental project. Notice for example here a huge area is covered with half-slabs to prevent spawning.
The spawnable area is +/- 8 chunks from each chunk where there is a player (minus the chunks on the edges of that area). If a single player is online, mobs spawn in 240x240 blocks area centered on the player chunk, that is roughly +/- 120 blocks from the player.
There's an oddity in monster spawning you can exploit. As is well known, mobs can spawn on top of any block with a flat, opaque top surface, even if there is a non-solid block such as a torch or rail on top of that block.
However, the selection of center points for groups (“packs” as Minecraft Wiki describes them) of mobs is slightly different: it requires that there be empty space which is an air block, nothing else (not even a torch). Only once such a point has been found will mobs spawn with their feet at that level in the area around that point.
Therefore you can prevent spawning entirely as follows: make sure that in the vicinity (up to 20 blocks horizontally) of your rail station, at any particular y-level, either there are no empty air blocks, or at the y-level below it there are no regular valid spawning surfaces.
For example, consider this cross-section of an underground rail tunnel.
5 ######### _ slab
4 ### ### # stone/netherrack
3 ### ### R rail
2 ###R_R###
1 #########
No mobs can be spawned in the middle of a tunnel of this form:
- No mobs will spawn with their feet at levels 4 or 3 because there are no solid blocks below those levels (all individual spawn locations are invalid).
- No mobs will spawn at level 2 because there are no air blocks at that level (all pack spawn locations are invalid).
However, if there are any air blocks at level 2 within 20 blocks of the tunnel, then they may cause spawning. So, if the tunnel is in midair as such things often are in the Nether, you'd have to build a 20-block-wide flange beside the tunnel at level 2 to prevent spawns (preferably made of slabs so as not to itself be a spawning platform).
Disclaimer: I've never tried to engineer spawns in this way; I'm just going by others' documentation of the way it works. (And yes, this was already mentioned in the comments of this question; but answers should be posted as answers, and I felt a fuller explanation would be useful.)
Best Answer
I have built it (I don't want to use glitches in my game) and yes it works, but not as shown.
You can't light up a portal with that lava setup, so you're stuck with piglins spawning naturally in the portal.
A zombie piglin will spawn on top of an obsidian block at the bottom of the portal frame if any of the portal blocks on that vertial received a random tick.
So, taller portals = higher chances of a piglin spawning, and larger portals = more chances of spawn.
Also, more portals = more chances.
Here is my setup:
I have 17 portals that are 23x23 plus another 14 that are 23x16. They are gathering around a turtle egg I placed on top of a 2 high column of obsidian so that they would get close to my enraging platform, from where I throw an egg at them (and then I move to a killing pit).
This gives me a barely acceptable stream of 1 or 2 piglins per second. I stupidly started this project underground, under my iron farm, so I can't easily expand it, but if you want, you could theoretically build more portals directly above so that you could increase your piglin spawning rate.
Expanded it can look like this:
Another possible layout is such:
And if you feel like bringing it to an extreme: