That’s where having the sturdier car can help.
You also will want to be in the car that decelerates less briskly. That’s where, in collisions with movable objects, having the heavier car helps.
A heavy car without crumple zones from the 1950s that could kill you when hitting a wall at 20 km/hour might still be the safer car in a head-on collision with a much smaller car with a few meters of crumple zone (cars from the 1950s were incredibly unsafe, so I think this would require extra-ordinary circumstances)
If you crash into a wall at 20km/hr, it's a lot better if the engine bay gets smashed up, than if the compartment you're in collapses around you.