Before officially asking this question here, I looked it up here, and indeed found some corresponding answers. In this post:
Can "y" be used not just for locations?
Eau qui dort says:
Any locative complement can be pronominalised by y, the preposition used doesn't matter much so long as it's not de. Je me suis assis sur le banc : je m'y suis assis, j'ai réservé une chambre hors de la ville : j'y ai réservé une chambre. Of course, other options are preferred to this locative y in spoken French, but in the formal language, it can and does refer to every kind of locative complement
I would like to check the accuracy of this answer. Can one replace any prepositional phrase that indicates location (regardless of which preposition is the head of the phrase) for Y?