The termios.h header file is a standard Unix header for C compilers that deals with serial IO and has #define's for things like baud rate, special characters, etc. It would not typically be used on a Particle device.
Probably what happened is your new code is trying to use some Unix-like IO command or #define that does not exist on Particle and the compile is trying to drag in headers that it thinks will fix the problem.
I think this was a symptom of a larger issue - it seems that I was overrunning the flash space. This was due to the fact that I specified “pi” as my device (which it is). When I leave the device unspecified, the code fits just fine.