4.7 engine swap to a 318 or 360

I have a dodge ram 1500 great truck for the first 140,000 miles nothing but trouble since. I bought a reman engine from S and J and the engine over heated and pinged. They warranty the engine sent a new one, same thing this time they blamed it on my truck. I had the ECM checked and updated, had the fuel trims read all in spec, ran higher octane fuel, replaced fuel pump, air filter,plenum seals,thermostat,radiator,injector seals, coil packs are good and injectors are good still they blamed the problem on my truck . Got an attorney and they refunded my money bought another rebuild from Yamato PW engines ran great had a rear main leak they warranty that. 7 months later started to here valve train noise and pinged when towing a trailer, never did that with the original engine. So took it in had them check it out they found pitting number 8 cylinder did leak down and found 5% loss tight so the manufactures said it was a detonation problem and from the sounds of it my engine has to come out again. This would make it number 5 and it could cost me between 1300 and 2700 because I have had this problem before with the two previous engines. If it is something they did they will replace it. If I drive the truck the warranty is voided. Looks like I’m over a barrel. I have come to the conclusion the 4.7 should not be rebuilt unless you buy everything new including heads and it’s a junk engine! I got this feeling if I pull the engine out and send it back up magically they will tell me it’s my truck and all expenses are on me full price 2700. If I say no they send me a bill for tearing down and a box of parts. If I spend the money I’m going to be here again because all 4.7 engines are junk everyone I know who has owned one has had major issues. If I sell it someone else they will be going through this and it’s still a nice truck. So I would like to pull the engine and put a 318 or 360 in it. Has anyone done this? What engine is best? Should I get rid of the electronics or run a throttle body injection? Swap out ECM and engine trany from a donor car?