In Sekiro: Shadows Die Twice, the key to the door Sekiro locked three years ago can be found as follows:
We came to the location of Hirata's mansion three years ago.
The foster father from three years ago can be found in the burning yard.
After talking to the adoptive father from three years ago, you can get the key to the hidden Buddhist temple.