This is an excellent website about the Castles of Wales:>https://www.castlewales.com
Also check out:> https://www.visitwales.com/cadw
As others have said, start with Lancaster & work south. You will need to pass through Chester - well worth a look. Make CONWY your first stop in Wales - the castle is right above the train station.
Bangor is not really worth visiting - though you could use it as a base for trips by bus to CAERNARFON CASTLE , BEAUMARIS CASTLE & the Victorian PENRHYN CASTLE. Far more to see in NW Wales. Consider the SNOWDON MOUNTAIN RAILWAY.
To go by train from NW Wales to Cardiff - the fastest route is back along the north Wales coast to Chester and then south via Shrewsbury to Cardiff. (Direct trains operate on this route). Alternatively, consider going to Porthmadog by bus or from Caernarfon by WELSH HIGHLAND RAILWAY:> https://www.festrail.co.uk
From Porthmadog, it is possible to take the ’normal’ Cambrian line along the coast & then inland to reach SHREWSBURY (worth a look) and then a train down to Cardiff. The Cambrian Line is very scenic:> https://www.visitwales.com/destinations/north-wales/explore-cambrian-coast-railway-line
CARDIFF has 4 Castles in and around the city. CARDIFF CASTLE is in the centre of the city & is ‘owned’ by Cardiff Council. Unfortunately, the Council run commercial events on the castle green - so you might find it set up for a music concert. That said, it is well worth climbing the Norman keep and seeing the interior of the castle - which was owned by the Marquess of Bute.
CAERPHILLY CASTLE (Cadw) is just a 20 minute local train ride north of the city and well worth seeing - though the town is not up to much. En-route - could alight at Lisvane station for a walk in Cefn-Onn-Park - which is best in May.
https://cadw.gov.wales/2-1-entry-offer-transport-wales
CASTELL COCH on a hill side north of Cardiff is another creation of the Marquess of Bute on the site of a medieval castle. (Bus to Tongwynlais & then a 20 minute walk up hill).
ST. FAGANS CASTLE & MUSEUM OF WELSH LIFE is a 25 minute Bus (32) ride west of the city. Well worth seeing but undergoing renovations at the moment. This is free as it is run by the museum service - as is the NATIONAL MUSEUM OF WALES (closed Mondays). Note that the last bus back to the city from St.Fagans is around 2.30pm & the site is large - so go out ready for opening at 10am. (No bus on Sundays).
As well as wandering around the city centre - suggest you also try and visit Cardiff Bay = 1 mile to the south.