Does Android come with a built-in plain text editor?
No AFAICT, unless it it is preinstalled by the device manufacturer, for example some devices like Xiaomi, Huawei come with a preinstalled document editor (WPS), which not allows you to view but to edit text files as well.

As suggested above, stock android only comes with with text viewer , not editor, in any case if you need to install it, please see Izzy's list of suggested text editors