So I guess the interface (API) between the lens and camera has a way of saying: I'll take over the shutter function?
Would like to know.
Various lens parameters can be communicated to the camera, including static lens capabilities but also dynamic factors such as the current manual focus distance, current manual aperture, or focus mode.
So yes, they could do that. But some systems would be designed with the assumption that all lenses will have shutters, or that the user of lenses with shutters will set the camera shutter to remain open.
Sometimes the shutter release "button" is part of the lens instead of the camera.