The onset of X-ray emission in young stellar objects - A Chandra observation of the Serpens star-forming region