Why would you assume they are mutually exclusive? You can just do both.
For real, I believe most 17 year olds on this earth do not have the funds to invest in education AND in a retirement fond, so there are choices to be made. (there are also the choices of creating social bonds and investing into activities together, ...)
I can't imagine a scenario where at 55 years old, you would miss the 5% of your summer income you invested back in high school. But I can totally see a scenario where investing those 5% led you to increasing it to 10% in college, 20% on your first job, and being financially independent way before you hit the age of 55.
If those 5% were the question of whether to go with the group on a adventure together or not - and you end up alone at 55 years and not invited .. you might have rather invested different back then. But on the other hand I don't think those 5% of earnings with 17 make a difference later.
The only real difference they can make, if they made you start a habit of saving income for important purchases. (But not really fore retirement at that age. But each to his own)
I think if a teenager is the social type, or they have a positive (non-toxic) friend group, then absolutely - spend the money! It’s an investment in your friends that may or more not pay off.
But some teenagers don’t have much in common with their peers, are bullied in high school, or just want to move on to the “real world” and graduate already. For those kids, invest!
There is also a huge overlap between "kids who have wealthy parents" and "kids who can afford to invest".