How can I make preferences boxes open in correct display with SecondBar?
I'm not familiar with how SecondBar works, but it looks like it's just a hack that duplicates the menubar on an external monitor. There's no operating system support for a second menubar so no support for determining which menubar was clicked and which monitor to open the dialog in.

Perhaps the developer of SecondBar could somehow intercept the command and redirect the dialog, but I really doubt this low-level jiggery-pokery is possible.