That being said, I can think of some scenarios in which coins from different users end up in the same transaction.
Just out of a desire to be more educated on the subject, I'd like to understand how that could happen... In this case the 2 addresses are indeed part of
the same HD wallet -- it seems highly likely they are both owned by the same person.
Question: how do you know the bold part?
My assumption was the addresses were random. As an example: say you have a wallet filled with small inputs (0.00027
BTC, 0.0003
BTC, and more
like this address). Fees are high, and your wallet doesn't allow you to set a low fee. You give the private key for the address to a friend (don't do that!), and he consolidates your small inputs together with his own.
Another scenario would be when someone gets their hands on a compromised private key, although it's more likely to instantly sweep those.