I'm not sure how familiar with database relationships you are generally, but this article is a good starting point to learn how to set them up in Entity Framework. In this example Blog is equivalent to your Task, and Post is equal to your SubTask, so you can follow the same format as this code snippet:
https://learn.microsoft.com/en-us/ef/core/modeling/relationships?tabs=fluent-api%2Cfluent-api-simple-key%2Csimple-key#manual-configuration
This involves adding the list of sub-tasks to your task, and a reference to your parent task in your sub-task class. Then you'd define the HasOne/HasMany relationships in your DB context's OnModelCreating handler.
You'll want to make a SubTaskDto that matches the structure of your EF model, then add a list of them to your TaskDto. You'll then need to update your create/retrieve methods to map these sub-tasks to & from your EF models.