Scripting does have a command specifically for creating box text, so you could do something like this to create the text and center the anchor point within the resulting text (which will be centered within the comp):
var myComp = app.project.activeItem;
var myTextLayer = myComp.layers.addBoxText([300,500]);
var mySourceText = myTextLayer.property("ADBE Text Properties").property("ADBE Text Document");
var myTextDoc = mySourceText.value;
myTextDoc.text = "This is a line of text for my new text box.";
myTextDoc.justification = ParagraphJustification.CENTER_JUSTIFY;
mySourceText.setValue(myTextDoc);
var myRect = myTextLayer.sourceRectAtTime(0,false);
var newAP = [myRect.left + myRect.width/2, myRect.top + myRect.height/2];
myTextLayer.property("Anchor Point").setValue(newAP);