SIPAddHeader() vs PJSIP_HEADER(add...)

They work fundamentally differently, and as you’ve stated if you set PJSIP_HEADER then the header is set on THAT channel and not on any outbound channels. The wiki has an example for this[1] in the " Set headers on callee channel" section.

To also be specific, you were never changing or altering incoming headers in chan_sip. You were adding a new header, and because it predated pre-dial functionality it had to be implemented the way it was - where you set it on the incoming channel and then it got inherited to the outgoing channel.

[1] Asterisk 19 Function_PJSIP_HEADER - Asterisk Project - Asterisk Project Wiki