This gets brought up every time the topic shows up but https://www.nand2tetris.org is a course that abstracts how a computer works, and is worth checking out
The great Niklaus Wirth wrote a book which you might want to check out: Digital Circuit Design for Computer Science Students: An Introductory Textbook.
In college, we wrote a CPU simulation in C, for a simple architecture called "little computer". You could call it an emulator, but the whole idea was to faithfully implement all the pipelining and register renaming and stuff. A main loop iteration was equivalent to a clock cycle.
Like, emulate gates and keep building bigger pieces until you have a function that’s a CPU. Etc.
I guess I’m thinking a bit more lower level than an emulator where you implement an opcode using normal capabilities of your language of choice.
I guess TFA is pretty close to this in ways, too.