Although Boo Radley does know the children make fun of him (so does most of Maycomb), he places these gifts in the tree as a friendly gesture. We don't really know what and how much Boo understands, but he is generous with the children and winds up saving their lives, so he was well aware of the potential danger with Mr. Ewell, and therefore did worry about them like he was their guardian.
Like Tom Robinson, Boo is a generous person who keeps to himself and means no harm to anyone. When Mr. Radley fills up the hole with cement, this is similar to sealing up Boo in the Radley house. There is nothing wrong with Boo. He is misunderstood and mistreated by his father. It was that kind of mental abuse that first affected Boo and it was the town's reaction that made Boo want to stay away from everyone. Atticus is very objective and open-minded. It is probably not a mistake that Boo chose his children to reach out to since they would be the most likely to be open-minded and friendly as well.