The CPI does have formal methods for attempting to account for this:
https://www.bls.gov/cpi/quality-adjustment/questions-and-ans...
This can occasionally result in odd things, like when the introduction of unlimited cell phone data plans led core inflation to drop one month for first time in seven years: