In some cases, explosions are caused by a gas leak in a pipe of your tank water heater. The pilot light can set the leaking gas on fire, causing it to explode.
However, pressure building up inside the tank is more common. This means that electric tank heaters are not safe either. In fact, the second video featured an electric water heater. In the case that pressure does rise too high, the water heater should shut off and release the excess pressure through a safety valve.
Old units, unfortunately, are not always reliable and can easily fail. In a situation where the heater does not shut off, pressure continues to build up until the tank cannot hold it anymore, at which point it bursts.
There are ways to avoid an explosion. For instance, you should only receive repairs from an HVAC professional, you should schedule annual checkups, and it is best to keep water temperature low. All the same, these precautions are far from failsafe. Besides, what will happen if you forget one year and delay your checkup by a couple of months? What if you need to heat your water to a high temperature?
If you have a tank heater, you always have a potential bomb in your home.
So, what is the solution?
The only thing you can do to ensure total safety is to dismantle and remove your tank water heater.