It was approximately 10 years ago since I last owned and programmed on a Mac, but when I did, I didn't find programming on a Swedish Macintosh keyboard to be a big deal. It's not really worse than on a Windows machine, it's just a bit different.
In fact, looking at it logically, it makes sense to put all the types of brackets on 8 and 9, since all of {, ( and [ "belong" together). It also makes sense to put \ on Alt+Option+7 as well, since it's kind of an "optional" forward slash. Pipe is at Alt+7.
In fact, I would say I actually do prefer the Apple keyboard layout to the Windows ones, since there are a lot of special characters that you can type with Option on a Mac that require memorizing Alt-codes on a Windows box.
Of course, if you're used to it one way, it's kind of unfortunate to have to change, and re-learn a different way, but just use it long enough and you're bound to get used to it before too long.
Another option is to try a US layout instead. A lot of programmers will prefer programming a US keyboard, even on Windows. A lot of special characters are easier to get to on these keyboards. That includes commonly used characters such as ;, =, [, ], `, / and \ that can all be typed with a single unshifted keystroke on US keyboards, something that is not possible on a Swedish keyboard.
In fact, I believe there is even an "international US" keyboard layout which makes it possible to write the Swedish Å, Ä and Ö characters without too much effort, so if you only occasionally have to type in Swedish, but mostly do a lot of coding, a US keyboard layout may make more sense for you than a Swedish one.
I don't use a US keyboard myself, but it is objectively better purely for programming, so I understand why a lot of programmers prefer it.
TL;DR summary: You'll get used to it, and if it bothers you, try a US keyboard. Purely for coding, that's an objectively better keyboard.