Chosen Solution

The only way that my Macbook will turn on is if the charger is connected.

Perhaps a dead or defective battery or defective charging circuit. Have you run any of these battery checking programs? https://www.makeuseof.com/tag/apps-macbo