Regarding csrf attacks:
If I were to structure a link to a website that I knew would perform a desired action for me, I would just need to direct you to that website and the fact that you have a session cookie and are logged in would mean that the request is validated, even if I’m the one who sent you there.
Typical csrf protection entails (for one, never making changes on get requests) and also inserting a unique csrf token into the form of any page that you want a valid post request to be sent from. When validating a post request, you know that if that token is present and is valid, then the authenticated user sent that request from your webpage and not from some other untrusted source.
In other words, csrf protection is important for pre-validated requests. Such as when a user has a session cookie sitting in their browser that automatically validates every request.
The reason that SO answers says that headers aren’t a concern is because headers are provided every time for every request. An attacker would have to know it in order to send it with the request they want you to make, unlike a session cookie.