Thanks to everyone for 4.7/4.0 incompatibility confirmation, and to WJ60 for pointing me to that waterluvr post. Some updates if anyone is interested: The often-repeated claim that the SKIM and PCM are permanently linked and no good without each other definitely isn't true, at least in my case. As I mentioned, I got a 2002 PCM and SKIM from the junkyard, and installed both in my 04 with the original lock cylinder. As expected, the truck would start but stall itself due to the key not being programmed. That's when I realized I should try to just program the key, since my scanner (TOPDON ArtiDiag Pro) is supposed to be capable of that.
I went to the local Jeep dealer with my state vehicle registration, state ID, and the junkyard receipt, which had the VIN of the 02. They were more than happy to give me the 4-digit key pin for both VINs, no charge and no hassle. I went to program my old key to the new SKIM, and while it accepted the 4-digit code, I got a communication error during the actual programming. I tried wiping the three keys it said it had in memory and tried again, but same error. I don't know if this is an issue with my setup or a software bug, but I sent a report to TOPDON, so maybe that will provide some clarity, as key programming should be fairly simple. Maybe once a Jeep key has been programmed, it can't be reset to a different immobilizer, but that's definitely not the case with the Subarus I've programmed before.
When digging around in the scanner options to find the key programming, I noticed it also had "special functions" options for PCM replaced, SKIM replaced, and write PCM VIN. I figured I could try those with my original SKIM since it already had the key programmed to it. I installed the original 04 skim with the new 02 PCM and tried the "PCM replaced" function. I figured the 4-digit pin would follow the PCM since it's looked up by VIN in the dealer database, so I entered the 02 pin, and that locked the system out for an hour. Turns out the pin is always tied to the SKIM, not the PCM. After waiting an hour, I tried again. It accepted the 04 pin but had a communication failure during the "transmitting secret key to PCM" phase. Turns out, the PCM VIN needs to match the SKIM to communicate. So, I used the "write VIN" function to reprogram the 02 PCM with the 04 VIN number. Then I tried the "PCM replaced" function again, and it claimed to have finished successfully. I took the key out, put it back in, and the Jeep fired right up, running and driving no problem, with no check engine lights.
I still have the issue that the 02 PCM can't control the cooling fan on the 04, but other than that, this seems like an ideal solution. Would still love to get a SKIM delete at some point so I don't have to deal with chipped keys, but the VINs all match and the car runs so I don't think I have any legal issues. I've read that the PCM can store the mileage, but my scanner doesn't seem to have access to that, and from reading the forum seems like the only thing that can read it is a DRBIII. I think even that can't change it, so I'm not too worried about the potential for a mileage mismatch, someone let me know if I'm missing something I should be concerned about though. I'll keep hoping a local junkyard gets in a 04 4.0 6cyl so I can get the right PCM, but if one hasn't come up by summer when the car might overheat, I'll rig in a switch for the fan. It's a project car I bought for $900 for gambler racing, so it doesn't need to be perfect, far from it.