First and foremost, I applaud the love you have for your students. It is clear that you care for them deeply. I have no doubt that this desire to honor them as human beings works its way into your classroom and your private interactions with the students, and I have no doubt that this makes a real difference in many of their lives.
Second, I am unfamiliar with the norms of your country, so I don't know how well my answer will translate to a new situation. Therefore, what I say might not be entirely correct in your circumstance1.
However, if I could bear it at all, I would not tell them anything. I recognize that it can be heartbreaking to watch someone flounder year after year, but as a teacher, I do not feel that it is my place. I would, instead, speak to my administration. Are there guidance or scheduling counselors or deans? This kind of life advice should, ideally, come from someone above the level of a classroom teacher.
If I absolutely could not bear it, then the situation is somewhat different. This is now less than ideal! But if I simply could not hold it in, and I had the kind of warm relationship with the student where such an overture would be welcome, I might find a good moment and ask them about their goals, and ask them why they feel that they have been stuck in a 3-year program for 8 years. And then I would really listen closely to what they say next.
Depending on what they say, I might offer to help them in any way that I can, and I might further mention that there is no shame in switching majors. Their only obligation is to find something that they can be good at, could enjoy, and could help others with. If one program is not working, they should not allow the sunk cost fallacy to hold them in place, because they only get one life to live, and there is no reason to live it trapped in a box that they have made for themselves.
1 You see? Here I pretend here that my wisdom would be sufficient in my own circumstance. I do not consider myself so wise, nor so lucky! This kind of situation is very hard, and you have my sympathies.