I live in a place where you have to pull a permit to shit. Ok, not quite that bad but still very tightly controlled. Some of it comes from the general public's lack of common sense; a "hold my beer" while I put this penny in the fuse box attitude. Some of it comes from the union's misguided attempts to freeze independents out of the contracting business. Then too, there are any number of 'fly by night' operations that almost advertise 'Rube Goldberg works here.' Home inspections can be a great idea as can checking out a contractor's references (the BBB is not always the best place to go BTW). DIY home repairs like contractors, can be good or bad.
I have actually been known to install new elements in an electric water heater. Not a big job and not a real problem if you plan ahead to turn off the juice and drain the tank. I have never had to deal with an in home gas water heater. I don't do much more and drain and winterize the one on my motor home, but I would probably have the gas serviced by a qualified technician since I don't have any idea of its requirements and have no desire to learn.
My home hot water is off my oil fired steam boiler on a separate zone into a 'Super Store' tank. The boiler is an 85-90 % efficient unit and, while I haven't run a cost benefit analysis against gas or electric lately, but, with my old (less efficient) burner it was slightly cheaper and better for the boiler to run than be idle for months at a time. Electric is high here in NH and there are no gas lines where I live so it would have to be bottled.
I do have a friend in the business who loved to work here because the basement is clean, warm, well lit, and, cat odor free. He has great stories about; rats, bats, cat shit, vicious dogs, snakes in crawl spaces, housewives in peek a boo housecoats looking for a 'little off', and other great stories. Prices go up accordingly because of the extra time and aggravation and he swears he never took up any solicitations for laying a little extra pipe.