The preferred way to perform the above operation would be to create the data blocks and link them to the scene using the "low-level" API - RNA methods and attributes - instead of operators to achieve better runtimes and avoid incorrect context issues.
The following code replaces the operator call above to achieve the same behavior:
font_curve = bpy.data.curves.new(type="FONT", name="Font Curve")
font_curve.body = "my text"
font_obj = bpy.data.objects.new(name="Font Object", object_data=font_curve)
bpy.context.scene.collection.objects.link(font_obj)
If you're simply looking to reduce the lines of code by combining the creation of the text and specifying the body, the following code works similarly:
bpy.data.curves.new(type="FONT", name="Font Curve").body = "my text"
font_obj = bpy.data.objects.new(name="Font Object", object_data=bpy.data.curves["Font Curve"])
bpy.context.scene.collection.objects.link(font_obj)