The Crab had avoided the Lion and its team. It had sensed great danger coming from them, an decided that it was wiser to wait. The monsters that had followed the Crab outside of the Fiery Creek General Hospital proved him right when they challenged the Lion, as they were all obliterated in an instant.
The Crab was looking for prey, something that would feed it power. If it ate a few dozens of poor souls, it would become powerful enough to face the Lion, and maybe even have a chance of winning against her. The Crab sensed that most of the survivors in Fiery Creek were camping inside the Library.
The Crab could not access the Library itself, but the Horsemen communicated something onto him, and knew where it had to wait. It climbed the walls of a nearby building, and waited on top of it, waited until the Ram acted. The Crab had a good angle of the Library and, as soon as it could… it would just jump in.