It blindly follows the routing table from most specific and/or lower metric to the least specific/higher metric.
I don't fully follow your example (a diagram would really help here), but I think it would plainly not work. Packets needs to be able to flow both ways to work correctly (unless you're using a stateful firewall), so the source needs to be able to route all the way to the destination and the destination also needs to be able to send the response all the way back to the source. Both sides must agree on the routing.
ARP might save you there but there's still conditions where you might end up hitting the gateway for a local connection. It's kinda weird to have two overlapping subnets on the same local network, I would just avoid that.