Pressure-induced structural transformations and polymerization in ThC2