So, you first went up, captured that castle and one underground, then returned to the starting point and, after repelling the attack, destroyed the remaining teleporters?
In general, I cleared everything to the very top, immediately destroying the underground cities, then built a portal in the city, and without any threat to the castle from above, I calmly went to the left.
I noticed that the demon armies in the castles "at the top" are 10 times smaller than those in the portals. It would be okay if they stayed there, but they actively help their allies defend themselves against me.