A Dynamic Network Model of Societal Complexity and Resilience Inspired by Tainter’s Theory of Collapse