I worked on multiple Django monolith projects in the past years where parts of it with heavy client-side logic were offloaded to tiny Vue.js applications injected into the html template.
If data requires reloads or manipulations a side restful api needs to be created along the main endpoint which renders html. But it's fairly straightforward with DRF and the enforced by default apps/models structure of Django.
Until a certain point I find this arrangement enjoyable to work with. Once it stops, it's clear as day that the page should be rewritten from scratch with rendering on client side.
And then I also encountered errors just like op in my app layer about trying to execute a write query via read-only transaction.
The workaround so far is to invalidate connection on error. When app reconnects the cluster write endpoint correctly leads to current primary.