It’s a test bed for the latest unreal engine, but it still performs very well on a lot of different hardware.
The switch port likely struggles because it needs to be compatible with the other versions for cross-platform play, so it has to support the same resources (map layout/assets etc) that higher end machines do. There’s a limit to how much you can optimise something when you can’t fundamentally alter it and still keep your other customers happy.
Way back in 2018 they were able to optimize the game enough to bring up the PS4 build from locked 30 to locked 60. Few games have ever had a feat like that performed, so I don’t think “horrible optimized” is fair.