Suppose I send x bitcoins from A to P, and someone else sends y bitcoins from B to Q.
This could also be done in a single transaction, sending x+y bitcoins from A & B, with two outputs, x to P and y to Q. Or am I mistaken here?
(well, if I understood correctly, technically you don't just send x bitcoins from A to P, but you send all bitcoins from A to two outputs: x to P and the remainer (change) back to A or another address that belongs to the same owner as A)
The thing with Bitcoin anonimity is, if you see two or more addresses together at the input side of a transaction, you can assume they're in the same wallet, thus having the same owner.
If the above 'transaction combining' would be applied randomly on transactions that were initially unrelated, this assumption could no longer be made.
However, I don't know if this is possible at all? If a node confirms the transactions, could it decide to combine them, merging two transaction into a single new one? Or is this impossible without making the transaction invalid? (I'm not 100% familiar with the exact transactions protocol specs and the way they're signed and confirmed - obviously a node does have the signature of A en B to send x and y bitcoins to P and Q, respectively)
yes it is possible.
BUT, you can not modify a transaction, so a random node in the network could not merge two transaction. for this to work both senders should corporate, but not necessarily trust eachother.