If this is merely for debugging, can't you write a wrapper that forces
line buffering for a program? The wrapper could substitute your own C
library functions via LD_PRELOAD, or could run the program inside a
pseudotty a la 'expect'.
If it's for production use then I'm not sure it's a good idea to slow
down and complicate standard libraries and/or apps for a
fairly-specialized need.