Chosen Solution
My magsafe port failed, then I replaced it and now my battery isn’t detected and my MacBook won’t charge
At this point it sounds like your battery is bad and/or the charging logic on the main logic board is damaged. Often fake MagSafe chargers or ones that have a worn cable can damage your system OEM MagSafe Chargers vs Cheap Imposters: Teardown for Truth