I'd posit that it's more about liberalism and conservatism existing in the same form in both the judicial and political spheres. So it's natural that there would be an alignment come appointment time.
It's more interesting, to me, to see how their leanings shift over a career. 538 tried to quantify it and showed all justices get more liberal as they mature.
https://fivethirtyeight.com/features...hey-get-older/
I could recommend a book that speaks directly to your issue, but it's more about judges that run for public election and doesn't really apply.