The output is isolated, if there is leakage then it makes sense to connect the negative of the output to earth, It's fairly simple actually.
Proper earth pin can be a solution, I agree. Other mentioned solutions with higher insulation can work as well.
Grounding works only when it is properly implemented in
systematic approach and no errors are made in the wiring (I guess 99.9% of population and many electricians do not have a clue how earthing/grounding should work and be wired. Have you seen examples of
professionally wired sockets? I make no assumptions for a while now.). One wire snap in wrong place can be a complete disaster for grounded approach depending on circumstances.
My point is that
isolated means high resistance path to AC mains and
grounded means your are holding one side of the transformer
while thinking your are 100% safe. I think neither approach is inherently 100% safe - it depends on many factors and system level considerations.
---
Leakage current itself exists because "isolated" device is floating at ~half the mains AC voltage - this
unavoidable by default with ungrounded items (all most all voltage sticks/pens and many multimeters can illustrate this). Small parasitic capacitances act as a current limiter which results in small varying
non-harmful current. So people are very sensitive to this, so are not. And it depends on circumstances a lot (humidity, skin resistance, etc.).
If I recall correctly, sensitivity limits of human senses are measured when ~50% of population starts to see/feel an effect. With huge variation in human sensitivity levels, some are very sensitive to this particular effect.