Refactor how base paths are determined when resolving (#11776)

Change-Id: Ibf07046280d5f61df21681310ec28993b6daf50f