Fix RT #121509 : perl -d handling chdir().

See: https://rt.perl.org/Ticket/Display.html?id=121509

    [perl #121509] perl debugger doesn't save starting dir to restart from

Thanks to Linda Walsh for reporting the problem and RJBS for commenting
for initial approval. Fix and a regression test by Shlomi Fish.