DUPLO Train Action Bricks
You may want to contact the LEGO customer service about it and see if they can provide a replacement brick. Assuming your train is 10874 or 10875, they should still have it in stock and you can probably just order a new one via a replacement part order.

On the other hand, since the recognition appear to be indeed color-based this might not help at all.