Cities started to regulate Taxis, along with Barbers and others, to prevent some from loosing their jobs to lower priced competition. It was all about some being more equal than others. Public safety is merely the fig leaf.
I agree in part that there is a some protectionism however as a taxi driver my experience is that it is not all about that.