common sense, really
While this is true for many species it’s really not the case for foxes. Foxes chose to move into urban areas not because of a lack of habitat but because of the availability if food in towns and cities. Despite being only a fraction of the size of a rural fox’s territory, an urban fox territory contains around 100 times the amount of food a single fox needs. With that much easily accessible food lying around it’s no wonder foxes chose to colonize urban areas! Why scrape a hard living in the country when you can live the easy life and laze around getting fat in the town!
Foxes are also not typically forest dwellers. Ideally they like a mix of broken woodland, open farmland and grassland and do most of their hunting on woodland edges and farm fields. In fact, clearing forests creates more fox habitat! By clearing most of the ancient forests in the UK and converting it into farmland (as well as removing their natural predators) we’ve actually created a lot more fox habitat that allows them to thrive at much higher levels then they ever have done before. Urban foxes in the UK have a been living in towns since the 1930’s, long after the forests were cleared but before much of the major building that took place after the second world war.
Foxes also move freely between town and country. Foxes born in the town often move off into the country when they grow up, and foxes born in the country often migrate into towns. This is only possible because they have so much available habitat that they can freely choose where they want to live.
In short, while habitat loss is a big issue for many species it is not an issue for foxes. Foxes are highly adaptable and if they can colonize an area they will. Thus, they move into urban areas not because they have to, but because they want to!