Cannot Cancel Purchase Receipt Linked to Cancelled Sales Invoice

I created a Purchase Receipt and then created a Sales Invoice which updated the stock.

We made a mistake in the Purchase Receipt so in order to correct it I needed to cancel the Purchase Receipt. Before cancelling the Purchase Receipt, I cancelled the Sales Invoice (SINV-03871) which was linked to this Purchase Receipt through the stock update.

However, after cancelling SINV-03871 and attempting to cancel the Purchase Receipt I got the following message:

Cannot delete or cancel because Batch A80FD6F is linked with Sales Invoice SINV-03871.

Message

I was only able to cancel the Purchase Receipt after deleting SINV-03871.

I know this behavior was not like this in previous versions. Is this now by design or a bug that was somehow introduced in a new version?

ERPNext: v12.6.0 (version-12)
Frappe Framework: v12.4.1 (version-12)