Maybe the generator or alternator is wired to the wrong side of the ignition
And once it’s running it provides power to the ignition even with key off / battery disconnected

Disconnect your generator / alternator and see if the problem persists
-s