Well, in practice raiders are often built to counter expansions rather than other raiders. And the ideal for this role is to have them arrive at a target expansion as it's being built. So, assuming you embed this into your logic, your widget might still make raiders that have a bad matchup into enemy raiders.
Your widget also needs a cost filter, based on your current income and army value, so that you don't get stuck with a demistrider in the queue for several minutes of the early game while the stuff it's supposed to counter runs rampant.
On the topic of mixed raider compositions, the two vehicle examples act differently. As I mentioned earlier, some bad raider matchups for Scorchers become positive when there's one Dart in the composition because, while the Dart dies in exchange for the slow, it lets the Scorcher get on top of its target. Daggers, on the other hand, have a bunch of negative matchups turn positive when they hit critical mass to kill the target in a single salvo, so switching away from them to a riot may be an error that devalues all your existing Daggers.