When you use "bought" (Past Simple) with "had gone bad" (Past Perfect), "had gone bad" took place BEFORE the "bought". You are therefore saying: The fruits went bad, AND THEN I bought them. I don't think you would have bought the fruits if they were bad.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.