I'm losing data when my Raspberry pi talks to its USB connected Arduino
Probably you are losing the first line to the bootloader delay of the Arduino, after opening the port triggers a reset via the traditional wiring of the modem control lines to the ATmega reset, and the traditional default manipulation of those on serial device open.
Generally speaking you want to avoid using time delays to make serial code work, but in this case you could reasonably put a few seconds delay between the open and the first query.
Also beware of debug messages generating responses which are longer than the input - it's entirely possible for this to result in saturating the output baud rate, even when the input stays well within its capacity.