A workaround in Bash may be to define a function, export it, finally use timeout 25 bash -c to run the function. This is even less "directly", but at least syntax highlighting should work.
Frankly, since timeout is a separate program, I think there is no way to execute "directly". timeout 25 (...) would be possible if Bash implemented its own timeout and made it a keyword (like time; time (...) works).
Note in the below example we put $my_fifo in the environment of timeout. Your original code also requires $my_fifo in the environment.
#!/bin/bash
my_func() {
for i in {1..9}; do
if read line < "$my_fifo"; then
if test "$line" != "0"; then
exit 0;
fi
fi
done
}
export -f my_func
my_fifo=./fifo timeout 25 bash -c my_func