Nobody wants the safety car leading them over the line, but they could have just left the lapped cars and added a lap or two to the end as other disciplines do. Would have been fairer than that.
They could have red flagged immediately if they wanted a race.