Kimstu has good points. To add to it; I don’t know where you are, but pepper plants require long, light-filled days to flourish.
Some variables for success in overwintering peppers indoors:
If you dug up a large, fruiting plant, (or have a large potted one) and tried to overwinter it without long light days, or supplementary light from bulbs, it’s going to have some stress. It is trying to be friuitful and multiply under less than optimal conditions. The solution would be to cut back the plant hard, and let it hang on, but not producing fruit. Less stress. When winter is over, the plant can then be put outside, and will leaf out again, and produce peppers sooner than seedlings started.
You’ve found the downside of this; without enough light or cutback, the stress makes plants vulnerable to aphids and other pests. Just like when people are stressed out and susceptible to disease, plants are, too.
A big factor, too, is that people tend to not pay attention to plants during the winter months, just a normal case of non-observance, human nature; we wait until spring to want to love our plants . So, the neglect can result in underwatered indoor plants, stress again, which is prime territory for insect pests to move in.
Outdoors, in best conditions, the peppers have great light, water, and good soil to sink their roots in, and are healthy. Aphids may take out the new tender growth early in the growing season, but the plant usually recovers, aided by predators like ladybugs.
Honestly, aphids are incredible opportunists, utilizing new shoots of plants as food, and have an incredible reproductive pattern, asexual and sexual, and proliferate at the blink of an eye.
From my observation, though, they also are soft-bodied little sugar-steaks for other insects, who soon come and devour/balance them out pronto. The plants recover, and send out new growth, when in healthy growing conditions. No need to freak out.
Indoors, yep , a pain, because there’s no ecological balance, so you have to take up the slack and watch for infestation.