I’m sorry you had that experience too
I don’t work in a bank but a food store without public toilets, if we get asked by customers if they can use it (if they are desperate) we’re told only children and old people at our discretion and staff have to accompany them, wait outside of the door which is embarrassing but we have high value stock back store. This takes us away from our job on shop floor so as you can imagine we have to discriminate on need - the assumption being children and old people have less control so they’re a priority. Fortunately a public restroom was opened across the road so we no longer have that situation.
I can imagine banks have similar guidelines to us but maybe more strict because of security.