To get the list of groups that an application is a memberOf, you can make use of below query by including microsoft.graph.group:
GET https://graph.microsoft.com/v1.0/servicePrincipals/<SP_objectID>/memberOf/microsoft.graph.group?$select=id,displayName,createdDateTime
I tried to reproduce the same in my environment and got the below results:
I have an Azure AD application named TestApp and added it to the groups like below:

Likewise, I added that application to Group2 and Group3 as well.
To get the list of groups that this application is a memberOf, I ran the below query and got results successfully as below:
GET https://graph.microsoft.com/v1.0/servicePrincipals/<SP_objectID>/memberOf/microsoft.graph.group?$select=id,displayName,createdDateTime
Response:

You can also use below query where you will get only list of group IDs that an application is a memberOf like below:
POST https://graph.microsoft.com/v1.0/servicePrincipals/<SP_objectID>/getMemberGroups
{
"securityEnabledOnly": true
}
Response:
