How do I create an ePub (or mobi) from LaTeX or PDF?
Since epub is basically a zip archive of HTML, CSS and image files
plus a small amount of metadata, I would start by looking for
something to convert LaTeX to modern HTML.
I had "help" to convert my PDF to ePub. They didn't send me the KPF, but I eventually got Amazon Authors' Support to send it to me. She warned it's not editable. I unzipped it and found my original PDF, plus hundreds of "metadata" files that appeared to be mySQL stuff. And my "helper" wants $$$ to correct a few typos that I had no trouble correcting in the print-on-demand versions simply by uploading new PDFs.
Once you have HTML, the next step (generating an epub out of it)
should be relatively trivial, possibly to the point that you could
even do it manually.