The F-22 is intended (and the competing YF-23 was intended) to be an air superiority fighter to replace the F-15. The F-15 was a twin-engine model, as was the F-4 Phantom that it replaced. Twin engine planes have excellent "survivability," meaning they can take a lot of hits and still stand a chance of making it home (you can lose an entire engine and still stay airborne). They also are much higher-performance. The F-15 can takeoff, stand on its tail and climb vertically to over 40k feet. I've seen F-16s do something similar but they couldn't climb as high and they couldn't carry as much fuel and/or armaments while doing it.
The F-35 is intended to be a replacement for the single-engine F-16. The F-16 is a capable workhorse but it's more of a budget, multi-role aircraft, meaning it was designed, from the get-go, to do some air superiority AND some ground attack, operating on a tighter budget. We have considerably more F-16s in the Air Force inventory than we've ever had (or will have) F-15s and/or F-22s.
The F-15 used the same engine as the F-16 (two to choose from: either the P&W F100 or the GE F110), but two of them. When I was in the Air Force
- F-15's cost about USD 50 million
- F-16's cost about USD 35 million
Two engines and a larger, heavier airframe (albeit less sophisticated) added up to a significant price premium. In air combat, above 25k feet, my money would be on the F-15. At altitudes below 25k feet, my money is on the F-16. With an inherently unstable airframe and a computerized fly-by-wire system to tame it, the F-16 was wickedly maneuverable. The increased power of two engines on the F-15 working against the greater weight really loses the advantage at lower altitudes.
The "buried" engines in the F-22/YF-23 are trying to improve the stealth characteristics. The F-22's thrust vectoring, coupled with twin engines, make it more stealthy than the F-117 and faster and more maneuverable that the F-15 or the F-16. The YF-23 was arguably faster, but less maneuverable.
The F-35 is intended to cost less than the F-22 (debatable as to whether that will be the final case). And certain models of the F-35 are capable of a trick the F-22 simply can't match: STOVL. It can do a Short TakeOff and Vertical Landing. For the latter, the rear nozzle pivots downward 90% and a "lift fan" opens up in the forward fuselage. The F-22 was never intended to be able to do this. "Burying" the rear nozzle AND trying to do that would add a LOT of weight (and additional cost) to the aircraft.