That sounds about right. Sonic would probably do half damage (like fire does to most objects), and I think carpets should be immune to bludgeoning (maybe 1/2 damage from piercing?). They should have 0 hardness (comparing to cloth and rope). It's 2 hp/inch of thickness, but I'd think a large rug should have more. Maybe 2hp per 5x5ft square? Let's try this just for the mundane damage part:
Minor physical damage to the carpet does no damage to the carpet snake, but damage significant enough that the snake's image cannot fit in the rug expels the snake immediately, doing 2d6 hp of damage to the snake and dazing it for 1 round. Destroying the carpet completely expels the snake as above and kills it instantly unless it succeeds at a DC 15? Fortitude save. A typical rug has hardness 0, 2 hp per 5x5 ft square, and takes normal damage from slashing weapons, fire, and acid, half damage from piercing weapons, electricity, and sonic energy, quarter damage from cold, and no damage from bludgeoning weapons.
If that looks ok, then we can think about magic.