My father has a service dog through Paws for Purple Hearts/Bergin and one of the early commands they are taught is a release command that is for these kinds of situations. My father only really uses it for kids that are enamored with his dog but there are the rare situations where it is appropriate to ask if you can say hi.
I was curious and started reading into it, apparently the ancient Egyptians used to call electric fish (as they hadn’t discovered electric eels by that point) “Thunderer of the Nile”