If you use a Y adapter, then it doesn’t consume a motor port. You can still run a motor off that port via a Y-cable. Per <R12>, you can have one Y-cable on each 3-wire motor port.
Of course, you can’t modulate the flashlight this way, but hopefully a pair of light sensors with different filters should be able to discriminate between red and blue foam tiles.
Cheers,
- Dean