Self-ordering mechanism of quantum wires grown on nonplanar substrates