I have improved @naren-murali's answer. I think this implementation is what you need.
.custom-hover
.mat-expansion-panel:not(:has(.mat-content-hide-toggle)):hover
.mat-expansion-panel-header::after,
.custom-hover
.mat-expansion-panel:not(:has(.mat-content-hide-toggle))
.mat-expansion-panel-header:focus::after {
background-color: red;
content: '';
display: inline;
width: 16px;
height: 2px;
margin: 15px -4px 0 -12px;
}
https://stackblitz.com/edit/p4jjwk-hkndbv?embed=1&file=src%2Fstyles.scss&view=preview