You could use SMS my GPS. Per the app's description, it should meet your requirements just fine:
SMS my GPS listens for incoming SMS text/data messages and conditionally sends an automatic reply containing GPS location data. The „trigger-word“ and white-listed sender phone number can be configured in the app.
With just 190k APK size it's quite handy. Haven'...
One possible solution is to use Automate application. You can create flow to get current location and send it via SMS.
Unfortunately I do not have first hand experience but the application seems self-explained.
As per @izzy's suggestion in the comments, I've now found a number of theoretical solutions, and one that works, enough, in a way that I need.
I managed to get the Traccar app send data to a Traccar server, but I do not see a straightforward way to then get data out of the Traccar server.
There's also php-tracks-recorder, a web-based package which is ...