Strictly speaking, charge is discrete, there is no charge element dq, only charge element E, which cannot be expressed by differentiation.
But on the macro scale, the charge can be very well approximated as continuous distribution, which can be described by calculus. Well, dq is a small number that needs to be selected in mathematics. Physically, dq is required to be small enough in macro and large enough in micro. Small enough means that it can be regarded as infinitesimal on the macro scale. Microscopy is large enough, which means that the value of dq is much larger than that of elementary charge E, so the value of dq will not be significantly affected by microscopic fluctuations.
Similarly, there is fluid mechanics, which regards fluid as a continuous field analysis and chooses infinitesimal as the flow point. In fact, fluids are composed of microscopic molecules. The analysis also requires that the flow point be small in macro and large in micro.