Is there any way to make webkit-gtk smaller or break it up into multiple modules? Trying to compile it in gentoo routinely goes into 20 or so gigabytes of memory usage.
Not really, sorry. Use lower -j such as -j1 to limit parallel process for starters. Then experiment with increasing it until you find the highest -j your computer can handle without freezing up. You can also try -DENABLE_UNIFIED_BUILDS=OFF, but it's usually broken, so you need to be prepared to regularly send a lot of patches to keep this working if you want to try.
Usually the most critical part of compilation when it comes to memory usage is linking binaries. Something that helps is making sure you have the Gold linker installed, and that it is being used (CMake will print a warning if it was not found, IIRC). Alternatively, you *might* have better luck with the lld linker (which uses LLVM), but using it to build WebKitGTK has not been tested much, so YMMV. I hope this tip helps :-)