Cochineal and lac bugs are scale insects, which are related to things like aphids rather than beetles. They have sucking rather than biting mouth parts, for instance. Another difference is they don’t actually have complete metamorphosis, where larvae go through a dormant pupa stage before becoming adults.
Instead the “cocoons” are a waxy covering adult females make to protect themselves, at which point they become immobile. In fact I gather people originally thought of them as plant structures, which might have to do with why they made dye from them, although snails were popular too long ago. The young nymphs can crawl around, and adult males can fly though don’t live very long.