Repository: pydantic/pydantic
Issue: Discriminator needs literal error when validating literal field

### Initial Checks

- [X] I confirm that I'm using Pydantic V2 installed directly from the `main` branch, or equivalent

### Description

When defining a `field_validator` for a `Literal` field that is used in a discriminated union, A `PydanticUserError` is raised, prompting that the field needs to be of type `Literal`.

If the 2 `field_validator`s are commented out  in the example below, the models will be created without issue.

Is this expected, or is this a bug? I couldn't find any documentation referring to this edge case.

Thank you!

### Example Code

```Python
import typing as t

from pydantic import BaseModel, Field, field_validator


class AnimalModel(BaseModel):
    age_years: int


class CatModel(AnimalModel):
    name: t.Literal["kitty", "cat"]
    favorite_lasagna_brand: str
    # comment out the 2 field validators and model will work!
    @field_validator("name", mode="after")
    def replace_name(cls, v):
        return "cat"


class SparrowModel(AnimalModel):
    name: t.Literal["sparrow", "birdie"]
    color: str
    # comment out the 2 field validators and model will work!
    @field_validator("name", mode="after")
    def replace_name(cls, v):
        return "sparrow"


AllowedAnimalTypes = t.Annotated[
    CatModel | SparrowModel,
    Field(discriminator="name"),
]


class ZooModel(BaseModel):
    zoo_name: str
    animals: t.List[AllowedAnimalTypes]


if __name__ == "__main__":
    cool_zoo = ZooModel(
        zoo_name="Zoolandia",
        animals=[
            SparrowModel(name="birdie", color="red", age_years=2),
            CatModel(name="kitty", favorite_lasagna_brand="Tony's", age_years=20),
        ],
    )

    # raises PydanticUserError(
    # pydantic.errors.PydanticUserError: Model 'CatModel' needs field 'name' to be of type `Literal`
    # For further information visit https://errors.pydantic.dev/2.0.2/u/discriminator-needs-literal
```


### Python, Pydantic & OS Version

```Text
❯ python -c "import pydantic.version; print(pydantic.version.version_info())"
             pydantic version: 2.0.2
        pydantic-core version: 2.1.2 release build profile
                 install path: /home/aloustau/sandbox/pydantic2_learning/.venv/lib/python3.10/site-packages/pydantic
               python version: 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0]
                     platform: Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
     optional deps. installed: ['typing-extensions']
```


Selected Assignee: @adriangb

Changed files:
tests/test_discriminated_union.py, pydantic/_internal/_discriminated_union.py

diff --git a/pydantic/_internal/_discriminated_union.py b/pydantic/_internal/_discriminated_union.py
index 5f48e0257..13ac93dfc 100644
--- a/pydantic/_internal/_discriminated_union.py
+++ b/pydantic/_internal/_discriminated_union.py
@@ -429,7 +429,9 @@ class _ApplyInferredDiscriminator:
         elif schema['type'] == 'default':
             # This will happen if the field has a default value; we ignore it while extracting the discriminator values
             return self._infer_discriminator_values_for_inner_schema(schema['schema'], source)
-
+        elif _core_utils.is_function_with_inner_schema(schema):
+            # This happens if there is a `@field_validator` or similar wrapping the type
+            return self._infer_discriminator_values_for_inner_schema(schema['schema'], source)
         else:
             raise PydanticUserError(
                 f'{source} needs field {self.discriminator!r} to be of type `Literal`',
diff --git a/tests/test_discriminated_union.py b/tests/test_discriminated_union.py
index 0420acbd1..cb93ad304 100644
--- a/tests/test_discriminated_union.py
+++ b/tests/test_discriminated_union.py
@@ -8,7 +8,7 @@ from dirty_equals import HasRepr, IsStr
 from pydantic_core import SchemaValidator, core_schema
 from typing_extensions import Annotated, Literal
 
-from pydantic import BaseModel, ConfigDict, Field, TypeAdapter, ValidationError
+from pydantic import BaseModel, ConfigDict, Field, TypeAdapter, ValidationError, field_validator
 from pydantic._internal._discriminated_union import apply_discriminator
 from pydantic.errors import PydanticUserError
 
@@ -1232,3 +1232,72 @@ def test_union_in_submodel() -> None:
         'title': 'TestModel',
         'type': 'object',
     }
+
+
+def test_field_validator_wrapping_union() -> None:
+    """https://github.com/pydantic/pydantic/issues/6525"""
+
+    class CatModel(BaseModel):
+        name: Literal['kitty', 'cat']
+
+        @field_validator('name', mode='after')
+        def replace_name(cls, v: str) -> str:
+            return 'cat'
+
+    class SparrowModel(BaseModel):
+        name: Literal['sparrow', 'birdie']
+
+        @field_validator('name', mode='after')
+        def replace_name(cls, v: str) -> str:
+            return 'sparrow'
+
+    Animal = Annotated[
+        Union[CatModel, SparrowModel],
+        Field(discriminator='name'),
+    ]
+
+    ta = TypeAdapter(Animal)
+
+    assert ta.validate_python({'name': 'kitty'}) == CatModel(name='cat')
+
+    with pytest.raises(ValidationError) as exc_info:
+        ta.validate_python({'name': 'rabbit'})
+
+    # insert_assert(exc_info.value.errors(include_url=False))
+    assert exc_info.value.errors(include_url=False) == [
+        {
+            'type': 'union_tag_invalid',
+            'loc': (),
+            'msg': "Input tag 'rabbit' found using 'name' does not match any of the expected tags: 'kitty', 'cat', 'sparrow', 'birdie'",  # noqa: E501
+            'input': {'name': 'rabbit'},
+            'ctx': {'discriminator': "'name'", 'tag': 'rabbit', 'expected_tags': "'kitty', 'cat', 'sparrow', 'birdie'"},
+        }
+    ]
+
+    # insert_assert(ta.json_schema())
+    assert ta.json_schema() == {
+        '$defs': {
+            'CatModel': {
+                'properties': {'name': {'enum': ['kitty', 'cat'], 'title': 'Name', 'type': 'string'}},
+                'required': ['name'],
+                'title': 'CatModel',
+                'type': 'object',
+            },
+            'SparrowModel': {
+                'properties': {'name': {'enum': ['sparrow', 'birdie'], 'title': 'Name', 'type': 'string'}},
+                'required': ['name'],
+                'title': 'SparrowModel',
+                'type': 'object',
+            },
+        },
+        'discriminator': {
+            'mapping': {
+                'birdie': '#/$defs/SparrowModel',
+                'cat': '#/$defs/CatModel',
+                'kitty': '#/$defs/CatModel',
+                'sparrow': '#/$defs/SparrowModel',
+            },
+            'propertyName': 'name',
+        },
+        'oneOf': [{'$ref': '#/$defs/CatModel'}, {'$ref': '#/$defs/SparrowModel'}],
+    }