IANAL, but much of this is very simple. A derivative work is something based on something else, fundamentally. It doesn't mean something that's created by a pre-existing work, or something separate that works with the original. To go through some of your examples....
The PHP license is for using the language, presumably the interpreter. Programs written in PHP aren't derivative works, since they don't incorporate PHP themselves, but are written to work with PHP and are interpreted by it. (Even so, there's no reason there can't be multiple licenses on software, so that it can only be used under the intersection of the conditions.)
I don't know about Wordpress themes, but it sounds like something you'd create with Wordpress and use with Wordpress. If they incorporated something pre-existing, like a template, they'd be a derivative work of the template.
A work under a proprietary license can exist side-by-side with GPLed code, but compiling creates a derivative work from the source code (not from the compiler), and linking creates a further derivative work. Therefore, if you have an executable that contains some GPLed code, it's a derivative of that code (among others) and by the terms of the GPL must be under the GPL.
Apple does not in fact use Linux in MacOSX. Their OS is based on BSD, which is similar to Linux in function but a different OS kernel and differently licensed. They do ship GPLed software, like much of their software development kit, but anybody can do that. A collection of independent programs is not an actual work, and Apple (like anybody else) can ship GPLed software under the GPL.
If you're shipping a product that has something somebody else has written in it, it's a derivative work. If not, it's generally not. It doesn't matter if you used somebody else's program to create it, or if you need to use somebody else's program to use it, or if you're shipping somebody else's program along with your stuff.