Textures created in the current blend file cannot be used on the linked, Essential brushes. The textures need to be created in the blend file {Blender Folder}/{Blender Version}/datafiles/assets/brushes/essentials_brushes-mesh_texture.blend. An alternative option is to create a local brush which should be able to use local textures. The following script does the latter. There are many settings that you may want to set on the new brush and/or on the new texture. The script doesn't include any of that.
import bpy
# Create a new brush
new_brush = bpy.data.brushes.new("New Brush", mode='TEXTURE_PAINT')
# Mark the new brush as an asset to be able to select it in the Asset Shelf
new_brush.asset_mark()
# Create a new texture
new_texture = bpy.data.textures.new("New Texture", 'IMAGE')
# Assign the new texture to the new brush
new_brush.texture_slot.texture = new_texture
pythonand/orscriptingwhen you're asking about python scripting. Some people here actually use these tags for filtering. $\endgroup$