Hate to be pedantic but our star won't collapse it's not large enough for that, it will simply puff out and die leaving behind a very hot core called a White Dwarf
The oldest company in the world is only 1443 years old (Kongo Gumi of Japan.) Most companies don't last a single human lifetime. It's completely besides the point to bring up things that play out over billions of years in that context. It's just trolling.
There are a lot of good responses, but another is that these companies are all expected to pay dividends, do buybacks or liquidate some time between now and the end of the universe. Every stock contains that promise, or a chance of it, supplying the ultimate justification for a nonzero price.