How to hide all tabs (local tasks) except the user account tabs?
I wouldn't recommend not doing this by code, this can be achieved using built-in configuration settings, by using a second block with proper rules. Try this:


Go to Structure &gt; Block layout 
Select your theme
Place a second tabs block where-ever you want it
Limit the visibility on the block fitting your requirements


Most likely limit Pages to something like user/*
and by Roles, e.g. Authenticated user
(remember that administrators are authenticated users too, so you might need more specific roles to to prevent admins seeing tabs block twice; or add the "hide"-option on user-pages for the first, original tabs block )