Yes you are right. It is the dentin.
Enamel has got no nerves.
So when the dentist use his/her instrument, initially there is no pain (if the enamel is intact).
The next layer is dentin. As you said, dentin has got dentinal tubules containing dentinal fluid.
Whenever there is any stimulus which has not yet reached the pulp, but may have reached the dentin, eg of stimulus in the form of pressure, temperature change, sweet food, sour food etc, cause the fluid to move or get displaced. The displacement of dentinal fluid stimulates nerve endings in the pulp and hence generates a pain/ sensitivity response to your brain.
There are three main theories of dentine hypersensitivity:
Direct Innervation (DI) Theory
Odontoblast Receptor (OR) Theory
Fluid Movement/Hydrodynamic Theory
The Hydrodynamic or Fluid Movement theory is one of the main theories in dentistry to explain the mechanism by which a tooth perceives the sensation of pain. It is currently the most widely accepted theory used to explain tooth sensitivity.
Now the drilling causes heat generation, even though little, due to the coolant, plus pressure and hence causes the fluid to displace and hence pain. This pain usually ends after the treatment.
Hence anaesthesia is required.
Hope I have answered your question :)