The solution is as Pete mentioned. However, for the benefit novice Sitecore developers like me I'll post the end-to-end flow how I achieved this feature modification.
1.You have two ways to inject custom unsubscribe functionality:
Change the "CodeBehind" and "Inherits" attributes at "\sitecore modules\Web\EXM\Unsubscribe.aspx" to your own implemetation e.g.
CodeBehind="CustomUnsubscribe.cs"
Inherits="Feature.UnsubscribeNewsletterSubmitAction.Events.CustomUnsubscribe,Feature.UnsubscribeNewsletterSubmitAction"
Create your "CustomUnsubscribe.aspx" file, put in your hosted source code and refer in email campaign html/cshtml. e.g.
href="/sitecore%20modules/Web/EXM/CustomUnsubscribe.aspx"
and add this file to the config file as mentioned by Pete. To create a patch config you may follow the below code(N.B. Path file isn't mandatory, you may make changes directly in EmailExperience.ContentDelivery.config file if you wish).
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<group groupName="exm.messageEvents">
<pipelines>
<redirectUrl>
<processor type="Sitecore.EmailCampaign.Cd.Pipelines.RedirectUrl.SetRedirectToUrl, Sitecore.EmailCampaign.Cd" resolve="true">
<internalCarryoverFields hint="list:AddInternalCarryoverField">
<patch:delete />
</internalCarryoverFields>
</processor>
</redirectUrl>
</pipelines>
</group>
</pipelines>
</sitecore>
</configuration>
The above code deletes the "internalCarryoverFields" node.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<group groupName="exm.messageEvents">
<pipelines>
<redirectUrl>
<processor type="Sitecore.EmailCampaign.Cd.Pipelines.RedirectUrl.SetRedirectToUrl, Sitecore.EmailCampaign.Cd" resolve="true">
<internalCarryoverFields hint="list:AddInternalCarryoverField">
<carryoverField type="Sitecore.EmailCampaign.Cd.Pipelines.RedirectUrl.CarryoverField, Sitecore.EmailCampaign.Cd">
<param desc="fieldKey" ref="settings/setting[@name='QueryStringKey.MessageId']/@value" />
<param desc="urlPattern">.*CustomUnsubscribe.aspx|.*ConfirmSubscription.aspx|.*Unsubscribe.aspx|UnsubscribeFromAll.aspx.*|.*sc_pd_view=1.*</param>
</carryoverField>
<carryoverField type="Sitecore.EmailCampaign.Cd.Pipelines.RedirectUrl.CarryoverField, Sitecore.EmailCampaign.Cd">
<param desc="fieldKey" ref="settings/setting[@name='QueryStringKey.AnalyticsContactId']/@value" />
<param desc="urlPattern">.*CustomUnsubscribe.aspx|.*ConfirmSubscription.aspx|.*Unsubscribe.aspx|UnsubscribeFromAll.aspx.*|.*sc_pd_view=1.*</param>
</carryoverField>
<carryoverField type="Sitecore.EmailCampaign.Cd.Pipelines.RedirectUrl.CarryoverField, Sitecore.EmailCampaign.Cd">
<param desc="fieldKey" ref="settings/setting[@name='QueryStringKey.ContactIdentifierSource']/@value" />
<param desc="urlPattern">.*CustomUnsubscribe.aspx|.*ConfirmSubscription.aspx|.*Unsubscribe.aspx|UnsubscribeFromAll.aspx.*|.*sc_pd_view=1.*</param>
</carryoverField>
<carryoverField type="Sitecore.EmailCampaign.Cd.Pipelines.RedirectUrl.CarryoverField, Sitecore.EmailCampaign.Cd">
<param desc="fieldKey" ref="settings/setting[@name='QueryStringKey.ContactIdentifierIdentifier']/@value" />
<param desc="urlPattern">.*CustomUnsubscribe.aspx|.*ConfirmSubscription.aspx|.*Unsubscribe.aspx|UnsubscribeFromAll.aspx.*|.*sc_pd_view=1.*</param>
</carryoverField>
<carryoverField type="Sitecore.EmailCampaign.Cd.Pipelines.RedirectUrl.CarryoverField, Sitecore.EmailCampaign.Cd">
<param desc="fieldKey" ref="settings/setting[@name='QueryStringKey.Campaign']/@value" />
<param desc="urlPattern">.*ConfirmSubscription.aspx|.*Unsubscribe.aspx|UnsubscribeFromAll.aspx.*|.*sc_pd_view=1.*</param>
</carryoverField>
<carryoverField type="Sitecore.EmailCampaign.Cd.Pipelines.RedirectUrl.CarryoverField, Sitecore.EmailCampaign.Cd">
<param desc="fieldKey" ref="settings/setting[@name='QueryStringKey.TargetLanguage']/@value" />
<param desc="urlPattern">.*ConfirmSubscription.aspx|.*Unsubscribe.aspx|UnsubscribeFromAll.aspx.*|.*sc_pd_view=1.*</param>
</carryoverField>
<carryoverField type="Sitecore.EmailCampaign.Cd.Pipelines.RedirectUrl.CarryoverField, Sitecore.EmailCampaign.Cd">
<param desc="fieldKey" ref="settings/setting[@name='QueryStringKey.TestValueIndex']/@value" />
<param desc="urlPattern">.*ConfirmSubscription.aspx|.*Unsubscribe.aspx|UnsubscribeFromAll.aspx.*|.*sc_pd_view=1.*</param>
</carryoverField>
<carryoverField type="Sitecore.EmailCampaign.Cd.Pipelines.RedirectUrl.CarryoverField, Sitecore.EmailCampaign.Cd">
<param desc="fieldKey" ref="settings/setting[@name='QueryStringKey.EmailHistoryEntryId']/@value" />
<param desc="urlPattern">.*ConfirmSubscription.aspx|.*Unsubscribe.aspx|UnsubscribeFromAll.aspx.*|.*sc_pd_view=1.*</param>
</carryoverField>
</internalCarryoverFields>
</processor>
</redirectUrl>
</pipelines>
</group>
</pipelines>
</sitecore>
</configuration>
The above config code adds the "internalCarryoverFields" node with our custom page entry. Make sure you put the above changes in 2 different config files where node deletion is done first and then addition of custom page.
Post which I believe you will your custom logic to Unsubscribe the contact using ClientApiService.