Water heater gas control valves are simple devices without simple means to retrofit electronic ignitions. A knowledgeable controls technician will be able to do it, but will not do it for liability reasons. This means it can be done on one’s own with much effort, more than normal expense, and dangerous possibilities. Thus the water heater manufacturer and code officials will give no warrantee and you will void your insurance approvals.
It is simpler and less expensive to buy a water heater with the capability built in from the factory.
An electronic relighter, which senses a pilot failure and relights it before the safety unit can trip off, can be retrofitted to a water heater without modifying any of the current safety devices. The reason not to do it is that the cost would be about the same as a new water heater. If you are concerned about using a match to light the pilot, many manufacturers make heaters with Piezo push button ignitors such as are on BBQ units. Any electronic device would require an electrical circuit to the water heater.