@__DIR__ and similar should always give you an answer relative to the current file if you’re using inline evaluation (Alt-Enter by default). If you paste code into the REPL (manually or via Ctrl-Enter) then you’ll also get the REPL behaviour, which of course falls back to pwd.
If you’re seeing different behaviour then that’s a bug and I’d love to hear how to trigger it.