Scripts are already sync by default, and making them more sync would require a significant use-case to justify, because it's user-hostile. (That's why we have the
defer attributes, to make them less sync, and are trying to find more ways we can reduce their impact on the page.)
In this case, your actual problem is simple to solve - set the cookie with a response header, not a script in the page. That way all the resources on the page will have the correct cookie set automatically. This is pretty simple to do in any web programming framework.