Raspberry PI 4 vs EdgeRouter X

Exactly my setup - a small coms cab in the wall with an electrical outlet wired inside it and wired Ethernet back haul to AP's in the house. I use an ER-X. The ER-X runs very cool and is very small. It will handle half a gigabit fine (gigabit in one direction). It has generous memory (256MB) for adblock and such. It has generous flash (256 MB) for loading packages. That's the good.

The bad is that the ER-X CPU speed is decidedly mid-range. If you run SQM to tame bufferbloat, it will top out somewhere between 130-185 Mbps depending on OpenWrt version. It is good for ~20 Mbps running OpenVPN, and ~90 Mbps running a Wireguard VPN. So you are going to outgrow it sooner rather than later, if it is not already too slow for you. I've also noted it's getting pretty expensive to buy, which is strange. But I haven't found many alternatives as small as an ER-X with 5 ports included. So far, it does the job for me.

Like dizzy said - you need to manage ventilation in the small cabinet. I drilled holes in the top and bottom of my metal wall cabinet cover to get some natural circulation going through it. The heat mostly comes from the modem I also have in the wall cabinet.

If you do get an RPI4 someday, you are going to need a switch more likely than not, so if you start with the ER-X (already includes 5 switched ports), the ER-X need not go completely to waste if it becomes your switch - just something to consider. The NanoPi R4S might be something else to consider instead of an RPI4 - it comes with a nice metal heat sink case, two ethernet ports (so no dongle needed) and is small enough for a wall cabinet. It's also got plenty of CPU speed - comparable to RPI4.

Good luck!