I thought there would be an exchange that would return the merchant's assets if the exchange wallet was hacked,
There are. For example, when Binance was hacked for 7,000 BTC, they used their profits over the coming months to refund all the affected users so no one lost any money. However, there have been plenty of exchanges which have been hacked (or claimed they were hacked and more likely exit scammed) and not refunded their users anything - MtGox losing 850,000 BTC is the most famous example, but there have been plenty of others such as Quadriga, Cryptopia, and BitGrail.
whether market profits are stored in different purses so that they can return a small amount of the assets of the trader
Depends on the exchange, and no two exchanges will have the exact same set up in terms of number or types of wallets or types of security. In general, most exchanges have one or more central hot wallets which customers deposit funds to, which consolidate all deposits together, and which pay out withdrawals. They will also have one or more cold wallets which will serve as longer term storage for the majority of their funds, and they will move funds between the hot and cold wallets as necessary.