Here’s the translation note from the NET bible that has a similar rendering as ESV :
13:8 b tn The prepositional phrase "since the foundation of the world" is traditionally translated as a modifier of the immediately preceding phrase in the Greek text, "the Lamb who was killed" (so also G. B. Caird, Revelation [HNTC], 168), but it is more likely that the phrase "since the foundation of the world" modifies the verb "written" (as translated above). Confirmation of this can be found in Rev 17:8 where the phrase "written in the book of life since the foundation of the world" occurs with no ambiguity.
Sounds reasonable to me. Does this rendering work against a doctrine that you hold?
Aside from what I've mentioned before (I'm not sure you were a member at that time), that I believe the phrases "FROM the foundation of the world" and "BEFORE the foundation of the world" are applied to distinct things (distinct persons, etc), in Scripture, I also see the phrases "the book of life" and "the Lamb's book of life" to be more like what we see in...
Psalm 69:28 -
"Let them be blotted out of the book of the living [the 'Berean Study Bible' has it as "Book of Life"], and not be written with the righteous."
I see the underlined (2) to be referring to TWO distinct things (two distinct actions).
It seems, as I read in Rev, that it is possible for one's name to be "blotted out of the book of life" (per Rev3:5); but it is NOT possible for one's name to be "blotted out" of the "Lamb's book of life," only "written in" or "not written in" (it doesn't state "WHEN" it was written in THIS book [the esv is not worded correctly, here, for example as I showed]). The book of the living ('the Book of Life') is (as I'm seeing it) a record of all who have LIVED; one's name can be "blotted out" of THIS book (Rev3:5; Ps69:28, etc). "The Lamb's book of life" is a record of all who are SAVED; one's name cannot ever be "blotted out" of THIS book.
Hope this helps you see my perspective.
(I try to derive my doctrine/theology by what is written in Scripture itself.