Why do we use solar filters instead of simply reducing aperture of the telescope? Everywhere I read that to view the Sun in the telescope, one has to use a solar filter. The filter must be handled carefully to avoid any holes in it and even mustn't be stretched so as to avoid reducing its reflectivity in some spots. Otherwise it becomes dangerous due to possibility of overexposing/burning observer's retina.

But, if all we need is to reduce illuminance, and covering part of the telescope's aperture won't obscure the image (since the aperture is far from being in focus), why not simply reduce the aperture to a very small hole? Photo cameras do this all the time, why wouldn't this work for telescopes? Or does a solar filter block IR/UV light, in addition to reducing visible illuminance?
Suppose we want to make the Sun appear only as bright as the full Moon does in a 5-inch telescope.
A difference of 14 magnitudes is a factor of 400 000; we can either add a filter transmitting 2.5 millionths of the light (including UV and IR), or reduce the aperture diameter by a factor of 630.
We can achieve that by covering the 5-inch aperture with either a large #14 welding shade, a similarly dark solar filter, or a mask with a 0.2 mm pinhole.

However, angular resolution is inversely related to aperture.
For a wavelength of 500 nm and an aperture of 0.2 mm, the Rayleigh criterion gives 1.2 * (500 nm / 0.2 mm) = 0.003 radian = 10 arcminutes, about 1/3 the angular diameter of the Sun.
Even large sunspots would be blurred beyond recognition.
A 1.0 mm hole would give 2 arcmin resolution but make the Sun too bright for direct viewing.