Because EVM cannot watch events, we cannot send a token to an exchange and immediately get back some other token (EVM just does not "know" when it was send a token). As far as I understand, this is the reason why all exchanges I know require first create a wallet on the exchange site and first send the token to this wallet.
Then:
How do exchanges create a wallet? How does the exchange generate the wallet address? (We know that Solidity cannot generate random numbers. Is it done off-chain?)
How then the exchange could control this wallet, i.e. give it the "command" to send the token for the actual exchange operation? (E.g. if it is ERC-20, then the exchange could not control the token contract and so could not cause it to send the token for the exchange operation. If it is say an ERC-721 or ERC-1155, then the exchange also can't control the contract and the same trouble arises.)
So, I don't understand how exchanges work internally.