Using object manager is not allowed so answer above seems to be wrong.
Correct answer can be found in setup/src/Magento/Setup/Fixtures/TaxRulesFixture.php in setTaxMode method.
taxRateFactory and taxRateRepository together with taxRuleFactory and taxRuleRepository should be used.
//Add Tax Rate for selected Tax Mode
/** @var $taxRate TaxRateInterface */
$taxRate = $this->taxRateFactory->create();
$taxRate->setCode($taxMode)
->setRate(self::DEFAULT_TAX_RATE)
->setTaxCountryId(self::DEFAULT_TAX_COUNTRY)
->setTaxPostcode('*');
$taxRateData = $this->taxRateRepository->save($taxRate);
//Add Tax Rule for Tax Mode
/** @var $taxRuleDataObject TaxRuleInterface */
$taxRuleDataObject = $this->taxRuleFactory->create();
$taxRuleDataObject->setCode($taxMode)
->setTaxRateIds([$taxRateData->getId()])
->setCustomerTaxClassIds([self::DEFAULT_CUSTOMER_TAX_CLASS_ID])
->setProductTaxClassIds([self::DEFAULT_PRODUCT_TAX_CLASS_ID])
->setPriority(0)
->setPosition(0);
$this->taxRuleRepository->save($taxRuleDataObject);