One way of making them stay is to have a prestigious sprint stage near the end of the tour like the Champs Élysées.
Brutal back to back mountain stages in horrible weather where they might fail to make the time cut and a TT probably doesn’t sound that appealing to a sprinter.
I think it is a bit shit everyone leaving early, especially if you do it while gushing about what a great race it is.
It devalues the maglia ciclamino as well if it's awarded to the only sprinter who hasn't fucked off early rather than the most consistent.