First, it got hot enough to not just melt, but actually "fry" and crisp up and char the ziptie(s). Those are usually nylon, so that's very hot, probably over 200C / 400F.
Next, the windings are darkened significantly in some places (not just where the charred nylon has melted around).
The phase wiring (and probably other wiring) appears to have deformed insulation.
It's quite possible for one or more of the windings to have shorted to each other or to the stator laminations, or for wiring to have melted insulation enough to be shorted to each other.
The windings you can test for shorts if you disconnect the WYE connection between them, otherwise they all will normally read shorted thru that connection.
Without disconnecting anything you can test for shorts to the stator laminations.
Note that sometimes the shorts don't happen except while higher voltages are applied, so a regular multimeter wont' read them. For those you'd need a "hipot" tester. (if you get and use one, don't touch the lead tips with your fingers...it's high voltage).
That kind of damage occurs from sustained overheating, which usually happens from sustained overload.
To prevent this you need to know how much power it will actually take to do the worst-case parts of the job you need the system to do, which requires defining that job and the worst case conditions, then using calculators or similators like those at ebikes.ca to find out the power needed.
Once you know the actual required power, you can then buy parts capable of sustaining (not just peak!) that power long enough to complete the worst case parts of the job, without stressing them.
On a chaindrive motor system, gearing is almost everything. If a system is geared incorrectly for the worst-case load, the system will be overstressed or damaged by that load.
Note that a "cooling fan" could mean anything from a slight tiny breeze over part of something that needs cooling to something truly adequate to the job, to something liek a hurricane thru it's insides keeping it at ambient temperatures at all times. Whether what you have is useful or not we couldn't say, as you haven't shown what it is or how it is mounted, it's airflow, etc; all of that is critical to whether it does anything useful to cool things.
Generally unless you are cooling the inside of a motor (airflow thru it) it's not useful for extreme loads on the motor that create too much heat.