You can retrieve all the products assigned to a specific category by category id in Magento 2.
Used interface:
Magento\Catalog\Api\CategoryLinkManagementInterface
Get Method from the interface to fetch a list of all the products, public function getAssignedProducts($categoryId);
