I have the zsh option autopushd set which calls pushd in interactive shells for every cd, that way 90% of the time when I want to go back up to another path I can just use popd
I've tried things like that before but never got on with them. I found when I had many projects with similar directory structures it was easy to end up in the wrong place and took more thought to get to the right place than just cding
I use Fish and have keybinds for previous and next directory, 99% of the time when going up in a directory it's to (one of) the previous directory/ies I was in