Technically, yes, if you chose to extend the bellows on a bellows-equipped pinhole camera, the focal ratio therefore changes, and you would have to compensate the exposure accordingly. But, given the near-unlimited depth of field of pinhole, there's no reason to extend the bellows for close-focusing, as in a glass-lensed camera.

If you are interested in setting up a pinhole camera so as to be optimized for close-up images, make the focal ratio smaller (i.e. the pinhole diameter smaller) than what most formulae recommend for the "optimal pinhole size", since these formulae, by and large, are assuming objects at infinity. At subject distances close to the camera, geometric effects of blurring the image due to divergence of the light cone through the pinhole (from non-parallel rays) overwhelms the effects of diffraction.

True, keeping the pinhole diameter the same and instead extending the bellows does end up making the focal ratio larger, but it doesn't improve image sharpness for close-in subjects, since that is a function of pinhole diameter. One way to make this practical is to use a removable pinhole lensboard with a selection of pinhole diameters to choose from.

On a related subject, I also use "improvised optics", like magnifying lenses, binocular objectives, fresnel lenses, etc, as camera lenses in a homemade nested box camera (or on my Speed Graphic). The way that I compensate for the so-called bellows extension is simply to measure the distance from the film plane to the lens, with a metric ruler I carry with the camera, and divide this number by the aperture diameter. I'm typically using homemade waterhouse stops, so the aperture diameter is a known value. This way affords me the true focal ratio at any bellows extension, which I then merely transpose onto my light meter to determine the recommended exposure.

For example, my 150mm binocular lens has a 50mm diameter wide open, operating therefore at F/3 when focused at infinity. But for close-in subject matter, the box camera's focal length may measure, say, 225mm, therefore the lens is now operating at 225/50 = F/4.5 instead.

~Joe