All the head/tail lights on the market appear to have their own separate battery and separate switches
Not so.
There are battery-less lights that you can run from dynamo. Generally the rear light is wired to the front light, and the front light has a single switch that controls the rear light too. Also some front light models have automatic light sensors, that mean you don't need to turn them manually on and off based on light conditions.
Also, typically these days the dynamo-powered lights are also available as e-bike versions. The e-bike supplies a certain voltage, usually lower than the e-bike system voltage, and the lights run from the e-bike battery. Typically the e-bike system voltage is 36V and light voltage is either 6V or 12V, with some systems allowing selecting the light voltage. Out of 6V and 12V, the most recent standard is 12V so most recent e-bike systems give 12V.
Also many quality lights run from practically any voltage. For example, Busch&Mueller Lumotec IQ Cyo Premium (e-bike version) runs from anything between 6V and 42V.
Of course on non-ebikes, you will have to invent some way of mounting a battery. This is in practice so difficult that you may find it more useful to just go with a hub dynamo.
As for dynamo not producing enough power for rear lights, that's completely false. Dynamos produce traditionally 3 watts out of which traditionally 2.4 watts was used for front and 0.6 watts for rear -- at the time the rear was an incandescent bulb. Today the rear is LED, so you may expect it to consume anything between 0.1 and 0.2 watts, i.e. practically nothing.
If riding up a very steep hill, the front light brighness dims but the rear light does not all that much. You will be visible from the rear in practically all conditions. Besides, most quality rear lights have a standlight function which produces light even if stopped at traffic lights. Today all quality front lights also have a standlight thanks to a supercapacitor, but it's mainly useful for you being visible from the front, because the front standlight is not as bright as the beam when riding at very high speeds.
Just make it simple and use a hub dynamo!
Or if you prefer the DIY approach, buy the e-bike specific lights and add a battery of compatible voltage. For example a holder for 6 or 8 Sanyo Eneloop batteries wired in series would give the required voltage (usually 6V min), but I suspect riding at very high speeds might make the Eneloops drop from a battery holder unless you add electrical tape around them, which makes charging them more difficult since you need to remove the electrical tape to put them into a charger and add the tape back again after charging.