You are correct the NEC does not prohibit this, but as stated the other codes have certain rules. The only one I am aware of and it is enforced here prohibits the regulator on the gas meter from being mounted within 3 feet of a circuit breaker due to the possibility of the regulator releasing pressure.
People think strange things about different utilities being in close proximity, (especially home inspectors). Why wouldn't it be safe to put a sub panel next to a gas water heater? If the water heater is leaking gas you got bigger problems anyway, what about the furnace? It could ignite the gas when it starts up, but we still put furnaces next to water heaters. I've seen home inspectors write up an outdoor GFCI for being "too close" to a water spigot and Romex "too close" to water lines.