Is this supposed to happen to scripts added to prefabs?

I wrote a program to add a script to a prefab. I kept running and stopping the scene to test variables of other things. After a while, my games fps dropped to 3fps and the prefab had many scripts.

I was just wondering is this intentional that the instantiation of a prefab applys changes each time a script component is added? What is a potential use of this feature?

I got rid of the scripts by adding a line to destroy the added script if there. I could have prevented this by checking if the game object already had the script attached.

You basically solved your own problem.

This behavior is intentional - your program just kept adding these script components to the source prefab instead of the instantiated game object, so each new instance had all of them attached.