Even if fossil fuels are used to produce the electricity, by having all of the appliance itself use electricity rather than natural gas, you simplify infrastructure and make it way easier to transition to non "green"(er) sources of energy.
System performance is a multifaceted evaluation, to which there is no single lynchpin that guarantees better overall operation, and designers make trade-offs based on most common use cases.