MAC address, but devices don't care, by design they will connect if the SSID and encryption type are the same, actually, you can create a mesh wifi network at your house with regular routers or access points by doing so, connecting them with wired ethernet.
But it would probably be an annoyance in large multi hotspot environments, and could become another thing to train people to mindlessly click through like cookie prompts.
Fortunately many default network names at least contain some randomness these days, e.g. three bytes of an access point's BSSID, to make this less likely.
That's also the proper fix – pinning a WPA password to an individual BSSID would go against the concept of encryption being scoped to an ESS/ESSID, not individual APs.
Networks that are meshed by design take this into account and communicate about signal strength per client, handing them over when they notice a neighbor would be able to serve the client better.
My Fitbit has a "find my phone" feature that uses Bluetooth to tell the Fitbit app on the phone to make a loud whistle. It's kind of handy and ive made use of it several times around my house, but obviously isn't useful outside Bluetooth range.