why capacitor with triac?
It's probably intended to be a snubber. If the triac turns on with significant voltage across it then the capacitor discharges through the triac and there is not much limiting the current. Depending on the capacitor ESR, the inductance of the connections and the triac the current can easily exceed the amount required to destroy the triac and make it fail 'on'. It can also exceed the maximum to destroy a film capacitor and cause it to fail in one of a couple of ways.
There are capacitors available with built-in resistors for snubber use (often around 100-200\$\Omega\$), but this just looks like a bad design.
From the above-linked ST paper:

To keep the dI/dtON below 50 A/µs for TRIACs and below 100 A/µs for
ACSTs, the snubber resistance must be typically higher than 47 Ω
(refer to Figure 6). For a 20 A/µs maximum dI/dt, the minimum
resistance value is about 620 Ω. Therefore, depending on the component
used, some tests should be performed to define accurately the minimum
resistance value.