Driving comes from a root word meaning "applying force." This was defined possibly up to 4,500 years ago, it's hard to prove definitively, but definitely within the last 2,500 years. The ancient words carrum, carrus, carier, etc all refer to various wheeled vehicles that may have either been pushed by humans or pulled by horses, donkeys, etc. They were driven vehicles, and the human controlling the vehicle did not typically sit on the vehicle (either standing on a platform or walking near it).
Both cars and carriages were, at one point, considered "wheeled vehicles pulled by an animal." Other inventions, such as the train, had similar concepts, cars in the back, and an engine in the front. The first cars were also called horseless carriages, with the implication that the cabin area was the car/carriage, and the engine was the horse (which is partly why we refer to engine power as "horsepower"). Therefore, it was natural to state that we were driving these vehicles, since we were applying the force of the engine. Some of that terminology survives even to the modern day, when we talk about the "undercarriage" of a car.
Riding, in the meantime, originally meant to ride on top of an animal, be it horse, donkey, mule, elephant, camel, etc. When bicycles were invented, it would have looked very much like riding an animal, as you'd sit on top and control its movement. Also, we had other devices like sleds, toboggans, and other things we created to ride on top of various surfaces in all kinds of ways.
As such, that became the delineating line between riding and driving. If the vehicle was meant to be sat on and controlled, you were riding, and if you were controlling an external force, you were driving. If both applied, you were still considered riding. Riding is also the word we use to refer to passengers on many types of vehicles; only the person controlling the vehicle can possibly be considered a driver.
Arguably, e-bikes and motorcycles could come under the definition of driving, as one definition of driving is "operating a motorized vehicle", but because of the inertia of language (meaning, a drastic change of definition can take decades or centuries), "driving a motorcycle" is likely not going to become mainstream anytime soon. However, as long as riding and driving remains defined as they are, we will be riding bicycles and driving cars into the foreseeable future. Even automous driverless cars might still be "driven" simply due to language inertia for several decades.