Question: From what I understand, the purpose of a variable-pitch propeller (be it manually adjustable, or constant speed) is that it allows the engine to always operate at its most efficient speed, much like the transmission of a car. Is that correct? If so, if an airplane were to accomplish that another way (say, a hybrid gas-electric drive, or an actual transmission with shiftable gears\*), would there be any other advantage to having an adjustable propeller?

\*No, I don't know **why** you would want to mount a car transmission on an airplane. It's a hypothetical question. But now I have this picture in my head of a twin-engine plane with two gear shifts in the cockpit and two clutch pedals next to the rudder pedals.

Answer: 
The comparison with a car's gearbox is unfortunate, and leads to misunderstandings...

At the small airspeeds typical of takeoff, the inflow at the rotor plane is small too, and the prop needs a small amount of pitch in order to produce a large amount of thrust at maximum engine revs, the blades working at the angle of attack for best L/D.

But, on cruising flight, there is an important inflow at the plane of the prop disk, that inflow reduces the angle of attack, and –under those conditions– the propeller can deliver enough thrust at maximum engine revs (i.e., with the blades working at the angle of attack for best L/D) only if the pitch is substantially higher than at takeoff...

That's the rationale of the adjustable prop...
Propellers get more effective the faster they spin. The limiting factor is the speed of the blade tip, which must remain subsonic. So a propeller of a given size will offer maximum thrust when its RPM gives a blade tip speed of around Mach 0.8.

Maximum thrust is needed especially for takeoff and for maximum speed. When the plane is stationary on the ground the prop spins wholly sideways, but when at speed it has to follow a much more angled spiral path through the oncoming air. These varying conditions can only be met by varying the blade pitch.