Here is the mod which prevents retired cars from disappearing and keeps the activation of safety car and red flag.
It is by no way perfect but is better than the previous one. If you have changed the line <BehaviourRetire bool="true" /> in ai_driver_config.xml to false, you need to change it back.
In this mod, cars with puntured tyres or damaged front wings will pit for replacement. Cars with other damages but still movable will go off the track and retire. Cars with missing wheels will retire on the spot. These retired cars can be seen until the end of the race or red flag restart.
Retired cars on the track may cause pile-up especially for Monte Carlo. To solve this type of problem, codemasters make them disappear fast.
I have tested the mod in Quick race but guess it is ok for Career Mode. Nevertheless it is always prudent to make backup.
1) Essential changes:
a) In the file ai_choreographer.xml, add remove_unsafe_retires="false" as shown:
<set>
<discipline name="race" />
<manager enable="true" remove_unsafe_retires="false" race_start_race_only="true" race_start_distance_1="100" race_start_distance_2="115" race_start_distance_3="10" race_start_distance_4="10" race_start_factor_1="0.01" race_start_factor_2="0.0" race_start_factor_3="0.02" race_start_factor_4="0.02" race_start_factor_5="0.5" race_start_all_1="true" enable_offline="false" min_distance_offline="0.25" max_distance_offline="4.0" max_assist_inside="0.1" max_assist_outside="0.2" min_curve_offline="0.001" />
b) As the retired car/s that trigger/s safety car incident remain in the circuit, safety car may be activated repeatedly until the max no. of incidents allowed in the database.bin is reached. Hence it is necessary to change the values of max_safety_car of track_model to 1 if you don't want repeated activation. Interestingly, safety car incident triggered in the first 3 laps will be kiv and executed after the 3rd lap.
2) Optional changes to minimise the numbers of retired cars and pile-up:
Suggested values in ai_driver_config.xml. You can make changes that suit you.
<scMaxSpeedThroughIncidentZone float="100.0" /> to give sc more power to squeeze thru pile-up
<rtStuckTime float="7200.0" /> give max time for undamaged stuck cars, hopefully more will be recovered
<rtModerateDamageThreshold float="1.0" /> reduce effect of damage
<rtStoppedSpeed float="0.1" /> lower the limit of damaged car speed before it retires. Interestingly a value of 0 will have the same effect of <BehaviourRetire bool="false" and cars would not retire.
<rcRecoveryTimeOut float="7200.0" /> give max time for cars to recover
<rcThresholdSteeringForceToMove float="0.01" /> less force required to move the steering and helps recovering. 0 value is accepted.