your regulator rectifier is failing or about to fail.
at 25 mph your engine isn't reving high enough to be producing charge from the alternator.
When running at 40 mph you are now producing current. but because the rectifier is failing it is AC, indicator relays require DC and so the indicators won't work
Hitting the brake light acts as a SHUNT a current load this brings the charge rate down and so the regulator closes and the bike reverts back to DC.
Your battery is likely to loose a lot of water and is likely to fail soon
all other lights work ok as AC or DC bulbs will work fine.
check to see with the engine running and the lights on look at the headlight and rev the engine, if the lights brighten at the point the indicators stop working this indicates the break through point. if hitting the brake light causes the headlight to dim and the indiccators start working, this shows the reversion point.
you are likely to be needing a new charging circuit complete.
UNLESS you are using LED indicators, then have you tried a SHUNT in line with the indicators as LED indicators do not use enough current to switch the relay for the flasher unit.