depends how it’s designed / built innit.
we could build carbon frames that would last a life-time, but they’d be heavier than frames designed to last a few years and still be more or less as expensive. (cost of design + tooling + labour)
people associate high price with high performance, and rightly or wrongly expect an expensive frame to be light/fast.
carbon bikes are usually sold on their percieved performance benefits, rather than their percieved durability benefits.
don’t expect light / fast carbon frames to last for years and years and years, they’ve been over-built if they do.