It's unfortunate that simplistic "rules" are taught in beginning drivers-ed classes. This "never pass on right" is one of those unfortunate thing that lots of people think of as "law" but really is urban-legend. I've even had cops pull me over and discover when looking up codes to cite, that they were mistaken.
In CA
https://leginfo.legislature.ca.gov/f...r=3.&article=3.
21754. The driver of a vehicle may overtake and pass to the right of another vehicle only under the following conditions:
(a) When the vehicle overtaken is making or about to make a left turn.
(b) Upon a highway within a business or residence district with unobstructed pavement of
sufficient width for two or more lines of moving vehicles in the direction of travel.
*
(c) Upon any highway outside of a business or residence district with unobstructed pavement of sufficient width and
clearly marked for two or more lines of moving traffic in the direction of travel.
(d) Upon a one-way street.
(e) Upon a highway divided into two roadways where traffic is restricted to one direction upon each of such roadways.
The provisions of this section shall not relieve the driver of a slow moving vehicle from the duty to drive as closely as practicable to the right hand edge of the roadway.
21755. (a) The driver of a vehicle may overtake and pass another vehicle upon the right only under conditions permitting that movement in safety. In no event shall that movement be made by driving off the paved or main-traveled portion of the roadway.
(b) This section does not prohibit the use of a bicycle in a bicycle lane or on a shoulder.
There are actually
more sections prohibiting passing on left than on right.
* this section is basis of lane-splitting as it's been allowed forever for two vehicles to share an unmarked lane of sufficient width to safely accommodate both. I clearly remember our driving-instructor saying this was fine 35-yrs ago when I was learning to drive.