# pass ESP, ISAKMP
pass out on $ext_if inet proto udp from any to any port=isakmp
pass in on $ext_if inet proto udp from any to any port=isakmp

pass out on $ext_if inet proto esp from any to any queue data_ipsec
pass in on $ext_if inet proto esp from any to any

pass other proto....

So, I can see, prioritization is working here and there.

priorization is not working if on BSD_A I have:
pfctl -ss -vv
all esp 10.20.10.60 <- 10.20.10.20 MULTIPLE:MULTIPLE

i.e. pf "see" ESP as connection from BSD_B to BSD_A
all ESP from A to B packets (they must go into que) are just pass
as part of "keep state" on inbound connection,
this packet are not evaluated in pass rule, and are not part of data_ipsec que

Queuing only functions on outbound traffic. From your post, it appears to me that you are concerned that inbound traffic is not queuing. It can't. Did I misunderstand?

You also have Random Early Detection enabled for your IPSec traffic, which seems odd to me. RED is 1) designed to manage TCP congestion with multiple connections and this is ESP traffic between two gateways, and 2) it functions by dropping inbound packets when outbound queues reach thresholds you do not control.

Source of my wrong configuration is misunderstanding of "keep state". I thought, if there is keep state (by default), then it is not necessery put queue on every line. All that (packets in and out) is part of the same state. Obviously, it is not....