You might think that WoL is a unicast protocol given the MAC address, but it's not; it's based on a
subnet-directed broadcast packet. It has to work that way because it can't rely on ARP mappings, the FDB, etc. That much is true inside network B, but even more so in network A, where it couldn't see network B's ARP table or its FDB even if it wanted to. We speak of "broadcast domains" for this very sort of reason.
I'm not aware of any "run a script on ping packet" functionality in RouterOS, and if there were such a thing, I would consider it a massive layering violation, tying one of the OS's lowest layers (packet filtering) to one of its highest layers (scripting). Yuck.
Why not simply issue that "wol" call over SSH?
ssh myrouter /tool/wol mac=aa:bb:cc:dd:ee:ff interface=ether1
Wrap that call into a local shell script or batch file, and you can call it as "wake-server" for short.