Now: I have a (root) site with template "publishing". I am using SharePoint 365 Online
Goal: Change template of the existing site to "team"
Unfortunately you can't. Site templates just provides different features and page layouts enabled based on template type. So what you have to do is activate all features required. But what specific feature you are looking in team site. As per my understanding all the features available in team site is by default available in publishing site. But it is not true for reverse case, all features in publishing site is not available in team site. But by enabling some features on team site we can publishing site features and functionality.
So to do reverse like publishing site to team site, you would need to deactivate some features. Page layouts of publishing site, you can delete manually from gallery. List and Libaries again you can delete manually.
It is possible to add a modern site page in this template. Then all modern web parts, including Quick Links and Hero part can be added easily.
To enable Site Pages:
Activate Site Settings > Manage site features > Site Pages > Activate Add modern pages by going to Site Contents > Site Pages > New > Site Page
(It might take some time for the new setting to kick in)