CUPS is horrible, and also had its share of critical vulnerabilities. It is just better than the LPD mess we had before.
It is not a Linux specific thing - it was developed when there still were a lot of UNIX variants around. Apple was a very early contributor, and had quite a bit of influence in making it successful.
It’s no surprise Apple uses CUPS. They wrote it, after all.
Edit: TIL Apple didn’t write CUPS themselves but they bought the company that did it pretty early in the game. Here’s a LWN article from the time, exposing some of the worries that came with the news of the acquisition: https://lwn.net/Articles/242020/