Here's my simple snippet for use with Bash, to be added to ${HOME}/.bashrc:
# Commands to be executed before the prompt is displayed
# Save current working dir
PROMPT_COMMAND='pwd > "${HOME}/.cwd"'
# Change to saved working dir
[[ -f "${HOME}/.cwd" ]] && cd "$(< ${HOME}/.cwd)"
No need to find the pid of the most recent shell, the only requirement is a shell which supports running a command either when the prompt is displayed or each time a command is entered at the prompt.
The saved directory even persists across logout/login, if you don't want that, simply delete ${HOME}/.cwd on logout.
Note: If you have multiple terminals open at different directories, switch to the terminal whose directory you want to 'clone', type <enter> or run some other command at the prompt to save that directory, then open a new terminal.