Explaining the luminosity spread in young clusters: proto and pre-main sequence stellar evolution in a molecular cloud environment