It’s called adverse selection and informed order flow, and it’s one of the major challenges of market making. I believe they use trade secrets to try to prevent it as much as possible but they also instantly hedge if it does happen.
This is why HFTs pay so much for order flow from retail firms. Large orders on the books at public exchanges are subject to informed traders, while retail orders from Robinhood are random (or worse).