I'd buy a new transformer and make the doorbell and chime the only connections. That wiring makes me nervous.
The one I bought:
https://smile.amazon.com/gp/product/B000BQY88I/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
Yep, definitely the transformer.
I had ordered this Heath Zenith from Amazon but noticed it was getting hot. I ended up getting this Hampton Bay from Home Depot and keeping it because it doesn't get hot.