Technical details behind Apple's performance throttling of the iPhone
Short answer

To answer your questions:


The battery itself is not what's slowing the iPhone down, but rather iOS is deliberately doing this in the case of batteries that are below a certain level of health. 
Inserting a new battery fixes this because iOS then determines that the iPhone has a power source capable of meeting the higher power demands sometimes required by the iPhone when working at peak performance.
It is iOS doing the throttling, although it is doing this based on it's own assessment of the physical limitations of the battery.


Long answer

There are times when a device (such as an iPhone) will need a sudden burst (or peak) of power to perform a certain task. 

When this happens the power source has to be able to deliver the amount of current required by the device, but in the case of ageing batteries1, they often cannot meet this demand. If this happens, an iPhone may suddenly shutdown in order to protect itself from damage (this is similar to how the System Management Controller (SMC) of a Mac computer can kick in to protect your Mac from damage under certain scenarios).

What Apple was trying to do was deal with this issue by having iOS determine when a battery was no longer at a stage that it could meet a certain level of peak current. After iOS makes this determination, it slows down the iPhone so that it's running below its actual capacity. 

For example, by running the CPU slower it's limiting the power drawn from the battery. This in turn reduces the amount of power required and therefore prevents a situation in which the iPhone randomly shuts down on users. 

Apple took this approach in late 2016 after having received numerous reports from users of their iPhones randomly shutting down. Once they determined that the cause in most situations was an ageing battery, they included this 'feature' in iOS when it released the iOS 10.2.1 update.

1 Strictly speaking, a random shutdown could also occur when an iPhone is being used in cold conditions or when a perfectly good battery is quite low on charge. However, in the great majority of cases this issue arose because of ageing batteries.