Why are the lights on my 99 Honda Civic LX pulsing?

So I bought this car from someone off the facebook marketplace.

After I purchased it realized the headlights kinda flickered sorta bad, along with the instrument lights and reading light. I started to look into it right away, cleaned the ground connections best I could, Took out the headlights and cleaned their grounds as well as their sockets and found some melted plastic on both of the sockets.

Put it all back together and had 0 problems for a few days. Then one day I started my car, turned on my lights and they started pulsing worse than before. So i pulled over, turned my car off and restarted it. The problem went away.

It came back every so often, so i taped some wires in the engine bay even though i saw no exposed wires or anything that looked off. This made the problem way worse so i took all the tape off.

Sometimes they flicker when i first start my car and sometimes they don't at all.
Once i get up to and past 1500 rpm the problem isn't really noticeable.
There's an aftermarket stereo but nothing that i think would have immense power draw.

If anyone has any ideas on how i could fix this please let me know.

Sounds like the problem is in the alternator, not the wiring. Get a new (not rebuilt) alt. And i bet it cures the problem.

Simple, your alternator is getting a bit tired. Don't be long before it will need replacement.

Now you no why the car was unloaded. Any way. Check the alternator out put. Could be high or low. Check for AC content. If you don't know what I mean Google it. There could be an issue with the wire harness also from what you say.

Disconnect the alternator red hot wire and tape it so it doesn't ground out. Then run the motor and I'll bet the headlights don't flicker. Sounds like the alternator has a problem with AC ripple and needs to be replaced. Try running a ground wire to the alternator housing. Very slight chance that will help.