But I think it is more common and makes more sense too to put it the other way around:
Any sufficiently advanced stupidity/incompetence is indistinguishable from malice.