The sorting of rows seems to be broken if one axis is encoded as 'count()'.
Working Example with correct sorting of the rows:
import altair as alt
import pandas as pd
# init dataframe
df = pd.DataFrame({
"type": ['a', 'b', 'c', 'b', 'c', 'b', 'a'],
"value": [1,1,1,2,2,2,1]
})
# alt base
base = alt.Chart(df).encode(
y='value:O',
x='value',
color='type',
)
alt.layer(
base.mark_bar(),
base.mark_text(dx=5).encode(text='value')
).facet(
row=alt.Row('type', sort=['a', 'c', 'b'])
)

Once the encoding of x is changed to count() the explicit sorting order is ignored:
import altair as alt
import pandas as pd
# init dataframe
df = pd.DataFrame({
"type": ['a', 'b', 'c', 'b', 'c', 'b', 'a'],
"value": [1,1,1,2,2,2,1]
})
# alt base
base = alt.Chart(df).encode(
y='value:O',
x='count()',
color='type',
)
alt.layer(
base.mark_bar(),
base.mark_text(dx=5).encode(text='value')
).facet(
row=alt.Row('type', sort=['a', 'c', 'b'])
)

This appears to be a vega-lite issue. I've reported it in https://github.com/vega/vega-lite/issues/5366
Most helpful comment
This appears to be a vega-lite issue. I've reported it in https://github.com/vega/vega-lite/issues/5366