It was used many many years before boxing became famous.
“You may have heard the popular expression “saved by the bell” in reference to the popular ‘90s TV show or because it’s equated to a centuries-old practice in which people were buried with bells in their coffins so they could alert others in case they were inadvertently buried alive.Jan 5, 2023”
Im sticking with my interpetation.
Hmmm...
Both of these sites agree with me that “Saved by the bell” is a boxing term. The second site does mention your coffin theory, in order to debunk it.
https://www.merriam-webster.com/words-at-play/words-phrases-from-boxing-wrestling
https://www.phrases.org.uk/meanings/saved-by-the-bell.html
Enjoy.