Apologizing: When and how?

Say I have a discussion/argument with my husband and he says he’s unhappy/hurt/annoyed about something I said or did.

In my old way of thinking, if I understood in my head how what I’d said could be perceived as insensitive, unpleasant, or unfair, I would acknowledge his feelings, and apologize if I actually felt I’d been out of line.

If it was something I regularly did that makes him unhappy, then we would talk it out and find ways to make us both happy.
The reverse would also happen.

But now that I’m shifting to the idea that no one can hurt our feelings but ourselves, no one can make us feel annoyed but ourselves — and my husband is not doing this work — how do I reconcile both thought systems?

Under what circumstances is it justified to apologize? If the other person has not reached emotional adulthood and needs an apology to feel better and move on, do we just give that to him/her?

Thank you!