BlueJayy is right, numChildren decrements with every removal. But I would suggest a simpler approach of just iterating backwards:
for(i = numChildren-1;i>=0;i--)
This way, only indexes that have already been checked can shift. (e.g. if you start with numChildren = 7 (indexes 0,1,2,3,4,5,6), and you iterate backwards, finding your first Button at index 4, removing that once will shift index 5 and 6 down, but your next check at index 3 will not have changed.)