They matter within a company for the reasons you cite. They mostly don't matter between companies however.
You don’t think companies look at your past titles when you apply for a job?
Why do you think that? Senior, staff, principle levels are pretty standard across the industry, even if some companies call them different things
Titles are what “salary comparisons” go by when HR “compares” compensation between employees and “competition.”
What else would they be able to use?