Which would require more expensive (and larger) hardware than an ER4?
Not really. The comparison isn’t really valid.
A USG does MUCH more than an ER-4. So with similar hardware you can always run the same speeds on a USG and EdgeRouter because you’re turning features on and off that may not be important to you. Lots of people put up with the USG because it’s the thing that lights up all the bits of their Unifi display. Being under the control of the Unifi controller also slows things down.
A NUC is all you need to run pfSense. I think the cheapest pfSense Netgate device is about £100. Personally, I wouldn’t go under the SG-3100 which is £350 but that’s capable of running EVERYTHING at a 1Gbps Line speed. The equivalent USG (USG-XG-8) is £2400 although that is also a 10GbE device and the cheapest Netgate 10GbE device (SG-7100) is £850.
By all means buy an ER-4 but it’s not a Security device. It’s a router. If you want to replace the USG, it’s another UTM you want. And that typically means pfSense. Bear in mind too that you can sell your USG and get most of your money back.