diff --git a/mypy/join.py b/mypy/join.py
--- a/mypy/join.py
+++ b/mypy/join.py
@@ -175,15 +175,15 @@ def join_types(s: Type, t: Type, instance_joiner: Optional[InstanceJoiner] = Non
         s = mypy.typeops.true_or_false(s)
         t = mypy.typeops.true_or_false(t)
 
+    if isinstance(s, UnionType) and not isinstance(t, UnionType):
+        s, t = t, s
+
     if isinstance(s, AnyType):
         return s
 
     if isinstance(s, ErasedType):
         return t
 
-    if isinstance(s, UnionType) and not isinstance(t, UnionType):
-        s, t = t, s
-
     if isinstance(s, NoneType) and not isinstance(t, NoneType):
         s, t = t, s
 

diff --git a/test-data/unit/check-enum.test b/test-data/unit/check-enum.test
--- a/test-data/unit/check-enum.test
+++ b/test-data/unit/check-enum.test
@@ -1881,4 +1881,10 @@ class C(IntEnum):
 def f1(c: C) -> None:
     x = {'x': c.value}
     reveal_type(x)  # N: Revealed type is "builtins.dict[builtins.str*, builtins.int]"
+
+def f2(c: C, a: Any) -> None:
+    x = {'x': c.value, 'y': a}
+    reveal_type(x)  # N: Revealed type is "builtins.dict[builtins.str*, Any]"
+    y = {'y': a, 'x': c.value}
+    reveal_type(y)  # N: Revealed type is "builtins.dict[builtins.str*, Any]"
 [builtins fixtures/dict.pyi]

Unexpected type inference changes related to enum value attributes
In this example, the behavior changed in #11962:
```py
from enum import IntEnum
from typing import Any

class C(IntEnum):
    X = 0
    Y = 1
    Z = 2

def f1(c: C) -> None:
    x = {'x': c.value}
    # Old: builtins.dict[builtins.str*, builtins.int*]
    # New: builtins.dict[builtins.str*, Union[builtins.int, builtins.int, builtins.int]]
    reveal_type(x)

def f2(c: C, a: Any) -> None:
    x = {'x': c.value, 'y': a}
    # Old: builtins.dict[builtins.str*, Any]
    # New: builtins.dict[builtins.str*, Union[Any, builtins.int, builtins.int, builtins.int]]
    reveal_type(x)
```

These seem like regressions. The duplicate int types in unions seem like an unrelated issue that #11962 exposed. In some cases it can result in unions with dozens of items, which look pretty confusing. I'm not sure yet whether the second change is an issue with #11962 or something else.

mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumCreatedFromFinalValue mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumCreatedFromStringLiteral mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumBasics mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFromEnumMetaBasics mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFromEnumMetaGeneric mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumValueExtended mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFromEnumMetaSubclass mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumNameAndValue mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumValueExtraMethods mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumValueCustomAuto mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumValueAllAuto mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumValueSomeAuto mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumValueInhomogenous mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testIntEnum_assignToIntVariable mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumValueSameType mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumUnique mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testIntEnum_functionTakingIntEnum mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testIntEnum_functionTakingInt mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumMethods mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testIntEnum_functionReturningIntEnum mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFlag mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testIntEnum_ExtendedIntEnum_functionTakingExtendedIntEnum mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumCall mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testNamedTupleEnum mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFunctionalEnumFlag mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumIntFlag mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumIndex mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFunctionalEnumListOfStrings mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testAnonymousEnum mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumIndexError mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testAnonymousFunctionalEnum mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFunctionalEnumListOfPairs mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumInClassBody mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumIndexIsNotAnAlias mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFunctionalEnumInClassBody mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFunctionalEnumDict mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFunctionalEnumString mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testGenericEnum mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumKeywordsArgs mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFunctionalEnumProtocols mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumWorkWithForward mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumWorkWithForward2 mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFunctionalEnumErrors mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityChecksWithOrdering mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumAuto mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumIncremental mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityWithMultipleEnums mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityChecksIndirect mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityPEP484ExampleSingleton mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityPEP484ExampleWithFinal mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumAttributeAccessMatrix mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityNoNarrowingForUnionMessiness mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityPEP484ExampleSingletonWithMethod mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityPEP484ExampleWithMultipleValues mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityWithNone mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumAttributeChangeIncremental mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testAssignEnumAsAttribute mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityWithChaining mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityWithChainingDirectConflict mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityChecksBasic mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testPrivateAttributeNotAsEnumMembers mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumWithInstanceAttributes mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityWithChainingDisjoint mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testNewSetsUnexpectedValueType mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testIntEnumWithNewTypeValue mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumNarrowedToTwoLiterals mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReachabilityWithChainingBigDisjoints mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFinalValues mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFinalValuesCannotRedefineValueProp mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReusedKeysOverlapWithLocalVar mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testValueTypeWithNewInParentClass mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumTypeCompatibleWithLiteralUnion mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumImplicitlyFinalForSubclassing mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumExplicitlyAndImplicitlyFinal mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFinalSubtypingEnumMetaSpecialCase mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testSubclassingNonFinalEnums mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumReusedKeys mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFinalSubtypingOverloadedSpecialCase mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFinalEnumWithClassDef mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFinalSubtypingMethodAndValueSpecialCase mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumNotFinalWithMethodsAndUninitializedValues mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumFinalSpecialProps mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumLiteralValues mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumNotFinalWithMethodsAndUninitializedValuesStub mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFinalWithPrivateAssignment mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFinalWithDunderAssignment mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFinalWithSunderAssignment mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testFinalWithMethodAssignment
mypy/test/testcheck.py::TypeCheckSuite::check-enum.test::testEnumtValueUnionSimplification