I took a look at this.
It seems that the place ID ($0514) becomes 0xFF when you use the capsule on any untaken medicine. This is caused by the code $AEE1 (ROM:$1AEE1), and this probably intends to erase a medicine from the inventory.
And, apparently the game sometimes executes a strange address (e.g. $3820) when you "OPEN" somewhere on this glitch (confirmed on Mesen).
I haven't analyzed this game so thoroughly, but this glitch might have potential for further improvements.
When the place ID is 0xFF, the game reads out of bounds of some tables. for example:
* The game reads a minimap portal list pointer 0x3247 from the table $06:9023.
* The game reads a view rectangle list pointer 0x4001 from the table $02:9C00.
But, reading from $3247- or $4001- is open bus access. So, I think it might be difficult to control this as you desire.