Interplay of projectile breakup and target excitation in reactions induced by weakly-bound nuclei