Oh how tired we get. You meant before you drop the pan and go through the mess of replacing the crankshaft rear main seal, right? If you are looking to replace the sending unit in there.., well, lol, good luck.
You think that the gasket set, etc., are part of the issue? Hmmm.., you said he had done the head job.., maybe he lied, or you misunderstood him, i.e., it should have.., and here's a clue for you to find included in the deal... If the set is complete, it would have a head gasket, as well as oil pan, intake/exhaust gasket, etc., but not an oil sending unit. If incomplete, it would be missing some of the above, showing possibly what work was done.
So, just what sound do you get.., tapping, or a hammering sound. Have you used a stick, or stethoscope to determine if the sound is in the upper area, or lower area of your engine? Best way with a stick, is to place one end on your engine, (different areas to inspect), and the other held up with say your left hand, onto the back of your ear, on the mastoid bone, and with the other hand plug your opposite ear canal with one of your right hand's finger. So, you will be holding the stick with your left hand, and with a little finess manage to also plug up your left ear's canal with one of your left hand's finger. With both ears plugged up, (you could use foam ear plugs too), with one end of the stick on the engine, and the other end to your ear bone you will dramatically pin point the area of unusual noise, and that noise will rattle around inside of your brain pan enough to ascertain whether it's your lower, or upper side problem.
Before you drop your oil pan, have some plastigauge handy to mic your main bearings once pan is away. I've never had it happen to me, but sometimes the wrist pin wollows out it's bore through the piston/rod connection. I've heard that condition as "Piston Slap", but don't know what that sounds like, other than 'slap'. On the bottom end of the rod, i.e., the bearing cap, the plastigauge will determine if there is looseness therein, and that condition is going to give you a hammering knock as such a loose rod around the crank will do. Bent rods can do the same I have been told.., but that's just heresay to me. Anyway, with the plastigauge kit you will be able to find out if you have a bearing problem, or not. Might as well since you will have the oil pan removed.
I've had bad push rod tappets, solid lifters, hydraulic lifters when dirty, losing charge, or near-dead give a loud tapping sound on cold starts and at high speed. My old 258 Cherokee engine did that once at 75 mph, and was LOUD. Had some STP with me, and that plus driving slower cleared it up for awhile, but replaced them all, problem gone.
People sell vehicles for a reason, lol, with problems to be discovered by us poor servants in obamasama land. Well, that's not to fair of me to unload on that crock, as many people just pass on their problems to others. Did you know that in the old days some would put sawdust in bad manual transmissions in order to make a sweet deal to good to pass up? Hell, with XJ's I guess that's not to much in vogue these days, lol, as they all seem to have issues. "XJ for sale"--such a popular 4X4.., sure want one.., so one does, and it's a freak'in costly project. Welcome to the nightmare, 'er daymare as well.
I am uncertain about the 4.0 engine, but with older engines with high mileages, when one did a cylinder head job, it was prudent to replace all rings, as well as all rod bearings. However, some remark that the 4.0 can go further before that's necessary. Unless tolerances and metallurgy is vastly different.., I still do not believe you can do one without the other. A new head job will contain tighter pressures than the older parts can meet. Could be why the previous owner rid his developing problem created from mating a fresh head to a worn engine. Hence your problem now.
Sans crankshaft line boring, I've done engines in place, i.e., removing head, droping oil pan, removing rods, and pistons, some from below, some from above, and resurfaced cylinder bores, resurfaced valve seats by hand, reinstalled every thing fresh, and wa-la. Clean, clean, clean is the mantra. Tedious, but satisfying. My better engines came out when I sent out the block for oil/coolent boiling flush, line bore, head to a head shop, new springs, etc., new crank shaft, rods, pistons, etc., and thusly put back together on my time. Gives time to paint stuff while waiting on this and that, and replacing anything broken, i.e, manifolds, studs, shrouds, electrical repairs, throwout bearing/clutch/pressure plate installations, etc.
So, if things have not gone too far into the negative side, you are in a good position to make it back to the positive side with your 4.0 with minimal work. LOL, I think!
However, I defer to experts on the 4.0 here, as I've yet to experience it's bowels. Really! It is still mysterious to me, lol: When I got this new to me '89.., lol, the first thing I did was to grab my Buck Roger's timming light to check timming only to find out some French computer thingy, (ECU), controlled all of that. Pissed me off. Oh well...