how many lines of code can civilization support?

Is there any programming language theory that considers absolute upper bounds on how many lines of code (or bytes or whatever) a civilization can actively maintain (as a function of population size)?

Are such upper bounds low enough that the limit should inform programming language design?

Tail recursion, monads, and haskell

Please explain how tail recursion is compatible with "do" operator in haskell (IO monad case). To the best of my knowledge - it is impossible due to "do" operator design. It is sometimes possible to work around lack of tail recursion using monadic loop combinators, but this is manual replacement of recursion with iteration, all possible clarity advantages of tail recursion are lost. The code looks just like a plain iterative code.