This thought path has been explored by the Black Mirror series in the episode The Entire History of You.
https://black-mirror.fandom.com/wiki/The_Entire_History_of_Y...