You mentioned JSON column formatting, so I'm going to assume you are using SharePoint Online. if that's the case then I would suggest using Power Automate.
You would use the When an item is created trigger, get the attachments, loop through the attachments (SharePoint enables you to add more than one) to get the name of the last attachment, and then update the Title field value if there was an attachment.