Welcome! Sounds like you're doing pretty well. The B bit in the status register is a familiar stumbling block - I've listed a few previous threads below. The interesting and important observation is that there is no B bit stored in the CPU: when P is pushed with PHP, the B position is always written as a 1, and when P is pulled with PLP, the B bit from the stack has no effect.
In a sense, the problem arises when an emulator reports the B bit in the P register as a zero - it never is zero, and this leads to confusion.
The reason the B bit is meaningful is that when an IRQ causes P to be pushed, the B position is written as a zero, and in this case when the saved P is read from the stack with a PLA, the zero is meaningful. (Indeed, when the saved P is read with a PLA and the B position is read as a one, that's meaningful, if the P was saved by a BRK.)
I thought there was an essay about this in the reference section, but I don't see it... oh, in fact it's
here, on the visual 6502 wiki, presently accessible only from the Internet Archive.
Hope this helps!
Here are some previous threads:
Odd behavior with BRK bit being setBRK detectionbrk flag useless?(There might be some misguided "corrections" to some of our terminology here - best to ignore them, as we have so many threads hijacked for pointlessly pedantic purposes. Rest assured, your terminology and mine is widely used and perfectly acceptable to all reasonable people.)