This issue is similar:
copy span context to error context · Issue #476 · elastic/apm-agent-rum-js (github.com)
Found it in this older post:
Errors not getting labels from spans - Elastic Observability / APM - Discuss the Elastic Stack
There does not seem to be any way to get the original transaction or span data without manually doing multiple queries outside of the Kibana/Elasticsearch query capabilities and joining the data.