Test. Calibrate. Repeat.
There is a new method developed by NASA based on GPS tracking. And here's the same thing but as a video (also NASA).
New Method for Pitot-Static Calibration
A precise, time- and cost-effective method based on global positioning system technology using output error optimization (...) enables near real-time monitoring of error in airspeed measurements, which can be used to alert pilots when airspeed instruments are inaccurate or failing.
Webpage also mentions the current methods that include the trailing cone (the one you see on modern airliners while they are being tested), tower fly-by's, and pacer airplanes.
Trailing cones were first developed and tested in the 1950s and 1960s as a simple means of calibrating the static pressure error of an aircraft's pitot-static system.
So apart from it being time consuming, it should be relatively easy. If it says I'm doing 100 KIAS but I know I'm only doing 96, just calibrate the 100 to be 96. Probably needs a screwdriver and a certified mechanic. But doable. Same for the altimeter and so on. Altimeter would be easy to calibrate on ground. Put in the current QNH, check the reading against the actual (from an airport diagram) and take out your screwdriver (not literally).
The pitot-static system doesn't know the right pressure, it just needs calibration. Which also answers why the cabin atmosphere won't be as precise, it wasn't calibrated for that.