Lightning New Case action override

There is a solution that does indeed work, but it's a bit fragile because it's parsing the entire URL (assuming a structure that could change): https://developer.salesforce.com/forums/?id=9060G000000UaqdQAC (look at Pascal Le Clech's answer).

However, we can build on this idea and make it more structurally sound by using https://developer.salesforce.com/docs/component-library/bundle/lightning:isUrlAddressable to grab the new inContextOfRef which gives us a URL Addressable Base 64 encoded string. Here's a slightly more stable solution to Pascal Le Clech's solution:

aura:component

<aura:component implements="lightning:actionOverride, force:hasRecordId, lightning:isUrlAddressable">
    <aura:attribute name="recordId" type="Id"/>
    <aura:handler name="init" value="this" action="{!c.init}"/>
</aura:component>

controller.js

({
    init : function(cmp, event, helper) {
        var pageRef = cmp.get("v.pageReference");
        var state = pageRef.state; // state holds any query params
        var base64Context = state.inContextOfRef;

        // For some reason, the string starts with "1.", if somebody knows why,
        // this solution could be better generalized.
        if (base64Context.startsWith("1\.")) {
            base64Context = base64Context.substring(2);
        }
        var addressableContext = JSON.parse(window.atob(base64Context));
        cmp.set("v.recordId", addressableContext.attributes.recordId);
    }
})

As of today, you cannot capture the "parent context" on a lightning component invoked from a related list. We have had a similar situation and found out that it is not possible and ended up creating this idea requesting for a feature around this.

The alternative that we came up was to create a custom button on the parent record itself and then create the related list records. We invoked the same component that was invoked from related list, but were able to pass the parent context in this case. While this worked for the use case that we had, but it may be necessarily true in your case, but this is one of the options you can try.