This is the situation, I spent 30 minutes singing my child to sleep and my child felt to sleep, but then 5 minutes later my mom came to the child and touched his head to check if the child had a fever, which accidentally woke him up. That action was unnecessary because she could do that later.
I felt extremely upset and I said this to my mom "You must have had a lot of free time or you must have had nothing to do. Why did you do such an unnecessary / stupid thing?" (translated literally from Vietnamese, my mother tongue is Vietnamese)
Sometimes, we have a lot of free time or we have nothing to do or we may be bored, which may lead us to do extra unnecessary things which may ruin everything you tried before.
Another example, you fed your children a lot of food. Then the child didn't want to eat. If you stopped feeding him then he would be ok. But for some no good reason, you fed him with just a small mouthful of food. As a result, he threw up everything he ate before. You went extremely upset because you did such a stupid unnecessary thing which ruin every effort you tried before.
How to express "you did an unnecessary action which ruined everything you tried hard before"?