The purpose of the post is to confirm what you are struggling with figuring out and to give you a workaround, which is a bit of a hack.
The core challenge:
The ability to assign a Planner task via code.
What did I figure out?
This can’t be done via traditional .net code with a service account with global admin. Even if you create a service account that has access to the planner group, it will expire at some point/need to be refreshed; so it certainly isn’t a “set and forget” approach.
There is no way to use application permissions to create planner tasks without requiring user interaction.
The workaround (a bit of a hack)
Load the assigned task in a SharePoint list, then trigger a Flow that runs on a user (in the group), not a service account, to create the task.
Note: This isn’t a scalable approach and more of a hack, so it does depend on the business use case.