Formula One
For those that don't watch Nascar, the rules have developed there over the years to what is now very little gray area when it comes to how to handle a late-race yellow flag. Nascar has many more yellows than F1, and caution periods near the end of race are far more common. After years of inconsistency and race control's determinations based on "individual race conditions" drawing criticism from fans and writers/analysts, Nascar developed what is now known simply as Overtime.
The way Nascar's system works is that a race will not end under yellow unless the yellow comes out on the final lap. In other words, after the leader takes the white flag for the final lap, the "next flag" ends the race. They try to finish under green racing conditions but if a safety issue precludes it, they throw the yellow and the leader at that moment is the winner.
But any yellow flag before the white flag (to indicate the final lap) will result in at least two laps to go (green->white->checker). If a late race caution gets cleared before two to go, they run the scheduled distance as planned. But if they are unable to get the caution cleared with at least of two laps to go, there will still be (by rule) two laps to race - no matter how long the caution takes . . . which means the race goes in excess of the scheduled distance, but guarantees a two-lap race to the finish (hence the name 'overtime').
Under yellow, cars can pit if they choose, but will lose track position to those cars that stay out. And lapped cars are always sent around and/or lined up behind the lead lap cars, it's simply part of the procedure. But because there's guaranteed two laps of racing, there's no time pressure to have to make unusual decisions - they can get it right and then throw the green. And these rules are all very clear and everyone knows how they work and what to expect when a late race caution occurs - there's no discretion with race control. The only thing that remains discretionary is whether the incident itself merits a full yellow (there's no such thing as a section yellow on an oval).
Yes, going further than scheduled can complicate race strategy on fuel and tires. Some purists originally defended this idea strongly: a race is a pre-determined distance and it shouldn't be changed even if it means the final laps aren't raced because they're under yellow. But the idea that prevailed is that a race is an event held for spectators and viewers, and it is better for competition, for in-person fans who spend a lot of time and money to be there to watch a race to the finish, and for the overall drama of the sport to have the finish be raced rather than in a caution parade.
I think Nascar has it right. Again, it happens far more frequently in Nascar so they're not only more experienced with it but it's a more acute issue (because it happens so often). But in a situation like today in F1, the weakness of having so much ambiguity in the system brings substantial (and deserved) criticism.
Under Nascar's rule, the race today would have gone extra distance. The lapped cars between Lewis and Max would have been sent around . . . and then they would have lined up and gone green for two laps. And everyone would have known that was going to happen. So Lewis may have still elected to stay out, the question of the leader staying out or pitting for tires is always high drama in Nascar. But there's no griping about what happens because it's a set procedure. If you then lose to the second place guy because he has fresh tires, oh well that's just racing.