I want to understand how a switch and router work together to send traffic to a device off the L2 network.
The L2 network is the mechanism for L3 nodes to get their packets transported. When two neighbor nodes in a shared subnet talk to each other, they determine the destination's MAC address (by ARP or NDP) and send the encapsulating frame to that address (assuming a MAC-based L2 like Ethernet).
When the destination is not in the same subnet, the encapsulating frame is sent to the respective gateway instead.
Computer B is in a different subnet on the other side of a router. The switch does not find computer B in its MAC address table and floods the network to find it.
No, for the first part. The source node checks its routing table first. That check either determines that the destination is within the same subnet (=> ARPed and sent to directly) or which gateway is required. If the source cannot determine a gateway (no route to destination) it cannot send the packet. The switch isn't involved in that.
If the switch didn't know the destination MAC address of a frame it would indeed flood the frame, but since the router's MAC has already been learned (and all the other local ones as well) there's very rarely a need to do so.
Since the router is also just an L2 node, it would ignore all received frames that are not addressed to its own MAC address or a broadcast address - so flooding a remote MAC wouldn't help. Also, A would have a hard time finding out B's MAC address as ARP uses (local) broadcasting to find the destination MAC - and broadcasts cannot not cross a router. In a nutshell, remote MAC addresses are meaningless, they're only useful within a shared broadcast domain.