I have done the "go ahead and put a new engine in with a warranty" thing a few times in the last 5 years, and in every case it didn't work out as planned. You would think that a vehicle worth less than $10k couldn't have a whole lot of expensive serviceable parts once you have replaced the motor, right? Not so much...
The math seems solid - take an otherwise good vehicle that you know drives well that broken would sell for, say, $3k, spend $8k to get a new motor, or sell it for scrap and spend $10-11k for a replacement that could blow up tomorrow and have untold issues you won't find for a few months.
Works out right up until you put that $8k motor in, only to find that it didn't replace the other $4k in pieces and parts on the motor, and as they fail after you spent the money, you end up spending a bit more. Then something you wouldn't expect will go out, like power steering - there's another $1800.
The reality is any older car has the potential to nickel and dime you no matter how much you spend fixing it up. Just because you spend $5k fixing a $10k vehicle doesn't mean it won't nickel and dime you another $2k every year for ever...
In short, you made the right choice, especially given that it would have cost more for a motor with warranty than the truck was worth with the new motor...