There are already design standards for avionics software. DO-178 and DO-254, namely. Some car manufacturers follow something similar voluntarily. Maybe requiring something like this standard and having something like the FAA to enforce it is what we need?