Stars appear to regulate their own masses during formation