As outlined in the above diagram, response headers policies do not impact the origin-supplied headers stored in CloudFront’s caching layers.
Headers configured in the policies are inserted after the response leaves the cache, and before the viewer response event that triggers a function if configured.
If you have an edge function attached to the same behavior, policy inserted headers will be accessible in your function through the event object listing all the headers associated with the response.
You can use that functionality by treating the headers generated through a policy as inputs for the function that will impact how the code is executed. This is similar to using environmental variables.