There's a helpful map here:
https://datamap.gov.wales/maps/welsh-language-statistics/
Zooming in on Cardiff shows exactly what I described - Welsh is more common (although still rare) in affluent suburbs, and the central part of town along with the poorer suburban housing developments have the lowest level of Welsh.
Outside Cardiff, the effect is essentially reversed - rural areas with a (very) long farming heritage are among the few places where Welsh continues to be used as a daily language.
I think this scenario is quite easily explained due to the amount of funding given to the Welsh language and the corresponding jobs created centreing on Cardiff, as well as the requirement for members of the Welsh Government to speak Welsh.