I think you did fine. I would have done exactly the same. H broke his toe a couple weeks back, I knew because D told me. H told me a couple of days ago, and I just said " that hurts, I know how you feel" ( I am a regular breaker of toes lol).
We can be empathetic and sympathetic without nesting ourselves. People do it all the time with complete strangers. There is nothing to be said we cannot be the same with our spouses.
Friend is going to lend your W a car, so that is good. You offered truck, but you don't have to offer again and she doesn't have to feel some sort of debt, conscious or unconscious to you( which will affect the way she acts towards you etc)