I can't speak for PVG-SHA connections specifically, but this is common in Tokyo which has two major airports with international flights (NRT, HND) and consequently has lots of connecting flights between the two.
The rule of thumb is, if the incoming flight is delayed, the airline will take responsibility and get you on the next available flight if you can't make the connection. But if the flight is on time and you still miss the connection, it's on you. The minimum connecting times (are supposed to) account for customs clearance, so if you get stuck you're likely out of luck, although you can always try pleading your case to the airline.
For what it's worth, if traffic is a concern, you can avoid it entirely by taking Shanghai Metro Line 2 directly from PVG to SHA. However, this is a commuter subway, not an express train, so it takes about 90 minutes end to end with a lot of stops in between, vs 45 min by car if there's no traffic. If schedules are in your favor you can shave about 30 min off the journey by first taking the maglev (top speed over 400 km/h!) to Longyang Road and continuing from there by metro though.