Is it possible to self-consume the photovoltaic production when the low-voltage main switchboard is powered by a generator and not by the electrical grid?

Edited

Yes.
Whether with a centralized inverter or microinverters, it is possible to self-consume the electricity produced by the photovoltaic solar panels when the installation is coupled to a generator.

The inverter or micro-inverters need a 230V - 50Hz signal to synchronize with the local grid, regardless of the source of electricity production.