It’s not a myth that Crypto exchangers are sometimes hacked and cryptocoin are stolen then people lose all their coins stored in those exchangers. Exchangers offer trading facilities and storage wallet facilities as well.
It might seem as a perfect idea to store were you trade but remember every gambler knows when to quit so just make its a habit to withdraw your profits regularly to an offline or external wallet for safe keeping and only leave those you intend to trade with.
There is no way a hacker knows the balances of individual traders but it’s an obvious case that exchangers holds large sums of money in crypto. Exchangers reveal their capitalization to the public so the hackers will know and they will have a motive to attack.

There are exchangers which were hacked and lost coins in their wallets e.g. coincheck lost $534 million, coinrail lost $37 million and bithumb exchange lost coins worth $30 million and the investors rarely get back their money it will be all gone so it is highly risky to keep coins on an exchanger, instead use wallets like Exodus, Atomic or Trust wallet that way it is less risky.