If we treat every individual with equal rights, equal dignity, and equal laws, there's no need for "legally defining" gender. The only reason to do so is if you intend to treat certain "definitions" differently.