Again, it's about managing risk.
By dining earlier, cross contamination possibilities are lower: clean pans are plentiful, grills are newly scrubbed, flattop grils are still tidy; work stations are clean; even the staff is fresher if they've just started their shift.
Does it mean a careful restaurant won't be as careful with your meal at 9:30pm as they were at 6:30pm? No, not necessarily. But why not increase your odds of an allergen-friendly meal by dining early?