This seems to work for using a private key when sharing a .ssh\config between MacOS and Windows.
In the config:
# Windows-specific configuration
Match exec "cmd /c if defined OS (exit 0) else (exit 1)"
IdentityFile C:/Users/myuser/OneDrive/Documents/.ssh/id_ed25519
# macOS/Linux-specific configuration
Match exec "cmd /c if defined OS (exit 1) else (exit 0)"
IdentityFile ~/.ssh/id_ed25519
Then don't include an IdentityFile for the host entries.
Host the.host.com
HostName the.host.com
Port 22
User theuser
## IdentityFile "~\.ssh\id_ed25519"
Using expansion on Windows didn't work out.
Thanks to GPT for this one!