With a hub motor the wheel must be built true and tight, and maintained so by frequent inspection, and trueing as soon as it starts to get wrong.
12ga spokes are good only with rim washers, because they require too much tension for a bicycle rim to last. 14ga is good when they are quality spokes, even better laced with long nipples and rim washers.
Most of all factors, it is the angle of the nipple at the rim that makes a wheel last. A hub motor has a larger diameter than a normal bicycle hub, so the rims are not drilled for such an angle that is required with a large hub. Use a good quality wide rim, drill it to perfect nipple angle, use rim washers, lace it tight, maintain it true and tight... I proved it can last over 30 000 Km riding hard and fast.