I feel quite the same (struggle basically) as the OP.
My “stack” is self-control for blocking social and Gmail access.
And now I built QuiteCode to focus on deep coding and learning on a more mindful way.
https://gethopp.github.io/quite-code/