The lens has to be set at minimum aperture for lenses that have a CPU. There is a mechanical prong on the lens and it will not sit properly if the minimum aperture is not set on the lens. For non CPU lenses there is no such problem.
When you fit the lens it will open the aperture to full extent (say F2.8 if it is a 2.8 lens, F1.4 if it is a 1.4 lens) so that maximum light is available. You cane verify this by looking down the lens from the front, before and after it is attached to the body.
For lenses with CPU, when taking the shot, the aperture is closed mechanically. The body knows how much to move the linkage to get the aperture dialed in.
For non CPU lenses on D3xxx and D5xxx, the body has no idea of the maximum aperture hence it cannot determine how much to move the linkage to get the desired aperture. So the mechanical linkage will just move the linkage as far as it can go. Setting the aperture value in the lens, limits the movement of the linkage to the set aperture on the lens.
OT
This mechanical linkage for setting the aperture harks from the old days, when the cameras were purely mechanical. The mounted lens would be fully open, and stop down ;only when the shutter was fired; to the set value.
Originally, this linkage wasn't even for setting the aperture. It was just so that the camera could open the aperture all the way, when viewing, and then release it to close down to the aperture set on the lens' aperture ring when taking the picture.
On any non-G lens, when the lens is not mounted on a body, the aperture will be closed to whatever is set on the ring. Pushing this linkage upward will open the aperture, and releasing it will allow it to close down again. The earliest Nikon SLRs only did that much; when viewing, the linkage was pushed all the way up, opening the lens to its widest aperture; and when taking a picture, it was released, allowing the lens to close down to the aperture that was set on the ring.
It was with the AI-S development that this linkage was calibrated and made linear, so that it could be used by the camera body to control the aperture in an accurate manner.
And of course, with the G lenses, which have no aperture ring, this linkage becomes the only way to control the aperture.