I still would not have wanted a hug. It's interesting that in that situation your instinct was to not give a hug. It sounds like you later felt somewhat guilty about acting (or not acting in this case) based on that instinct. Instincts exist for a reason, whatever that reason may be, and chances are they are correct. A few consoling words, which I'm sure you provided, would have been more than sufficient if I were in his shoes.
I’m not sure my ‘instinct’ was that the man wouldn’t have appreciated it - workplace dynamics alone often overcome and inhibit accurate instinct and nature.
(He was a Black man younger than I, and lower on the ‘totem pole’ in the organization; but there existed a great deal of respect between us. I still wish I had given him a hug - it’s a greater investment than just words, and in the moment would have meant much more than the mere words I was able to muster.)