I upgraded to the latest kotlin version (2.1) and now isSystemInDarkTheme() works as expected.
My way to upgrading was generating a new kotlin multiplatform app (https://kmp.jetbrains.com/) and then putting the relevant import statements into my project.