It is unlikely to, because the kind of outbursts the OP described do not come from a place of logic, they come from a place of emotion.
It is highly likely that the child will not even remember what they said later on let alone be able to connect it with behaviour which is happening when they are in a highly emotional, oppositional/reactive state (at which point it is difficult for them to control an impulse anyway). The punishment is too far away and it only feels like it is related to the behaviour. It is not really, because the behaviour which is a problem is not a child saying that she doesn't like ice cream. That would be perfectly fine. The problem is the shouting and general being oppositional.
If you want to deal with it in a behaviourist way then you still have to look at the whole situation. It's a predictable scenario meaning there is something triggering the behaviour (antecedent) - it seems to be that after a full day of school, being offered something or presented with a decision or something unexpected is the trigger for the behaviour.
Then the behaviour itself is shouting/screaming/rude tone/opposition - the exact form of words that she takes is irrelevant because it's clear that it's a knee jerk rejection of anything at all even if it's something she would usually like.
It's most likely that the current consequence (what the child gets out of the behaviour) is venting her feelings, attention/reaction (even negative) from adults, feeling powerful by exerting her own will.
To change the behaviour in a behaviourist approach you would try to reduce any reward that the adult can control e.g. attention, by ignoring or reacting neutrally to the behaviour, and then offering more attention/reaction when she is talking in a calmer way, or you could add some kind of external consequence e.g. losing a small part of a privilege for the behaviour you're trying to reduce, or gaining a sticker on a reward chart or other small reward for a successful trip home without shouting.
If the behaviour is not changing, rather than adjust the reward or punishment, it's more effective to reduce the gap between what's currently happening and what you want, so for example rather than a fully calm walk home being the goal, you focus on only one aspect e.g. name calling or swearing. Then once that is established you can focus on volume and once volume is reduced you can work on tone.
For a more rounded (not purely behavioural) approach I think it does help also to look a bit more in depth and consider if it's a possible sign the child is struggling, especially considering she is usually fine by the time they get home and it's predictably happening after school. That indicates to me it's a stress behaviour and so personally I would not go purely behavioural but if I was going behavioural, it would be very small steps and very mild consequences, while also trying to work at separate times on increasing skills (e.g. emotional regulation) and seeing if there are stressors in the environment which can be reduced (fewer demands on way home, possibly looking at support in school and/or skills they need for school).
You said why be kind to someone who is acting this way - because it's important for adults to model the behaviour that they want children to emulate, and we should all be kind. When a child is screaming and shouting and threatening, screaming and shouting and threatening back at them just legitimises their behaviour because they see an adult doing it and internalise the message that it is OK. You might "win" if you are engaging in a power struggle because adults can easily overpower children and most children are aware of this and will react to it by complying, though I do think this does damage to your relationship. Not necessarily insurmountable, and if there is enough warmth to balance it out and the child can generally meet the expectations of adults around them, that kind of parenting is what many people do (not necessarily with shouting!) and it doesn't cause any major problems.
But some children are operating under very high stress loads to begin with, and/or there is a much larger gap between their current skills and adult behavioural expectations, so they experience a lot of power struggles most of which they lose. Power struggles are stressful. Stress behaviours are (unsurprisingly) likely to get worse if you increase the child's stress level. For a behavioural expectation that the child is struggling to meet, a power struggle is not going to help anyway so it's counterproductive or could easily become too extreme on the adult's level. Being kind is one way to recognise that this is a stress behaviour and immediately reduce the stress in the environment, which can help in turn with the behaviour, which you can work on the underlying reasons for outside of the moment.