The string (varchar) representation of a date depends on your "locale" settings (e.g. dates in UK are often represented differently than in the US).
In your example above, your first CAST() explicitly specifies the format of the varchar, but the second one forces the database to examine its locale settings to determine how to format the varchar result.
The simple fact that the conversion depends on something external to the CAST() function makes it non-deterministic.
In other words, you run the CAST() with one locale setting, change the locale then run the SAME CAST() again, and you get a different result. This is the definition of non-deterministic behavior.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…