I think people may say that the Earth is in danger because of the things that mankind are doing to it. There is a lot of deforestation, air pollution, pollution being dumped in rivers, lakes, and oceans, etc. So this is perhaps why the Earth is in danger. By putting the Earth in danger we are putting ourselves in danger as well because we need the Earth to survive. Without a healthy Earth, humans cannot flourish.
There are many organizations that exist that are trying to bring environmental awareness to the forefront. I believe that people are becoming more aware of how important it is to take care of the Earth.
It would help if you could tell us what you are thinking about here -- what is it that is making the Earth (or the people) be in danger?
In general, I think we would say this sort of thing because from our point of view, the Earth is only important because we humans are on it.
When we say global warming, for example, puts the Earth in danger, of course you are right to say this is wrong. In fact, only people (and some animals and plants) are in danger.
But because we seem like the most important things on Earth, we say that the Earth is in danger whenever we people are in danger.
The planet Earth is a system that consists of far more than just mankind. We are a small element on the planet that has caused great damage to it.
We could not say that mankind is in danger because man alone is not in danger. All plant, animal, land formations, and spheres are in danger. Everyone of those things encompass what makes up the planet earth and its life sustaining systems.
Nothing exists on the plant that does not have an influence on another system on the planet. The water systems shape the land. The rivers mold the land and the water revives it. The water system provides water for the life forces on the planet.
It is all of earth at risk of harm not just mankind.