Question: I just bought Left for dead 2 in the recent Steam sale and thought I'd try single player first. However trying to play the first campaign I always find my AI team mates stop defending themselves or attacking zombies at the start of the 2nd level. Which makes it seriously hard to keep them alive.

Has anyone else experienced this and know a solution?

Answer: 
In my experience, that's just how they are. Just ignore them as much as you can (impossible to ignore completely), and rescue them when necessary. 'least, that's how I usually treat it.
AI in Left 4 Dead 2 is not bad but pretty limited compared to an human. If you can, try playing with friends or other unknown player. 

It is much more fun and no frustration due to strange bot behavior.