Repository: pydantic/pydantic

Issue:
Available attributes are not found & side effects in pydantic.dataclasses.dataclass
### Initial Checks

- [X] I have searched GitHub for a duplicate issue and I'm sure this is something new
- [X] I have searched Google & StackOverflow for a solution and couldn't find anything
- [X] I have read and followed [the docs](https://pydantic-docs.helpmanual.io) and still think this is a bug
- [X] I am confident that the issue is with pydantic (not my code, or another library in the ecosystem like [FastAPI](https://fastapi.tiangolo.com) or [mypy](https://mypy.readthedocs.io/en/stable))


### Description

Since `v1.10.*`, it seems that pydantic does not find anymore certain attributes even though they are available in the classes. Moreover, it seems that `pydantic.dataclasses.dataclass` has some side effects on the provided objects now.


Consider the following MWE where we set up a dummy dataclass

```py
from dataclasses import dataclass as vanilla_dataclass
from dataclasses import field, make_dataclass
from typing import ClassVar

from pydantic.dataclasses import dataclass


class Foo():
    bar: str = 'cat'
        

default_config = make_dataclass(
    cls_name=Foo.__name__,
    bases=(vanilla_dataclass(Foo),),
    fields=[("bar", ClassVar[str], field(default=Foo.bar))]
)
```

Then, we pass this dataclass to pydantic and subsequently ask for the `bar` attribute:
```py
config = dataclass(default_config)
print("Get Attr", getattr(config, "bar"))
setattr(config, "bar", 'dog')
print("Get Attr", getattr(config, "bar"))
```

In `pydantic<=1.9.2`, this code runs successfully and will first print `cat` and then `dog`. 
However since `v1.10.*` the second last line (`setattr(config, "bar", "dog")`) will raise:
```py
AttributeError: 'DataclassProxy' object has no attribute 'bar'
```
This is surprising because the attribute is actually there! The third last line will find the attribute and print its value ("cat").

Even more suprisingly, it seems that this issue can be fixed upon calling `dataclass` twice. 
```py
config = dataclass(default_config)
config = dataclass(default_config)
print("Get Attr", getattr(config, "bar"))
setattr(config, "bar", 'dog')
print("Get Attr", getattr(config, "bar"))
```
will run through.
This seems to suggest that `dataclass` has some side effects on the passed object (`default_config`).

It would be great to hear your thoughts on this.

### Example Code

_No response_

### Python, Pydantic & OS Version

```Text
pydantic version: 1.10.2
            pydantic compiled: True
                 install path: /Users/jab/miniconda3/envs/gt4sd/lib/python3.8/site-packages/pydantic
               python version: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:05:47)  [Clang 12.0.1 ]
                     platform: macOS-10.16-x86_64-i386-64bit
     optional deps. installed: ['typing-extensions']
```


### Affected Components

- [X] [Compatibility between releases](https://pydantic-docs.helpmanual.io/changelog/)
- [ ] [Data validation/parsing](https://pydantic-docs.helpmanual.io/usage/models/#basic-model-usage)
- [ ] [Data serialization](https://pydantic-docs.helpmanual.io/usage/exporting_models/) - `.dict()` and `.json()`
- [ ] [JSON Schema](https://pydantic-docs.helpmanual.io/usage/schema/)
- [X] [Dataclasses](https://pydantic-docs.helpmanual.io/usage/dataclasses/)
- [ ] [Model Config](https://pydantic-docs.helpmanual.io/usage/model_config/)
- [ ] [Field Types](https://pydantic-docs.helpmanual.io/usage/types/) - adding or changing a particular data type
- [X] [Function validation decorator](https://pydantic-docs.helpmanual.io/usage/validation_decorator/)
- [ ] [Generic Models](https://pydantic-docs.helpmanual.io/usage/models/#generic-models)
- [ ] [Other Model behaviour](https://pydantic-docs.helpmanual.io/usage/models/) - `construct()`, pickling, private attributes, ORM mode
- [ ] [Plugins](https://pydantic-docs.helpmanual.io/) and integration with other tools - mypy, FastAPI, python-devtools, Hypothesis, VS Code, PyCharm, etc.


Discussion:
This will be fixed in 1.10.3

Resolving patch:
diff --git a/pydantic/dataclasses.py b/pydantic/dataclasses.py
--- a/pydantic/dataclasses.py
+++ b/pydantic/dataclasses.py
@@ -254,6 +254,9 @@ def __call__(self, *args: Any, **kwargs: Any) -> Any:
     def __getattr__(self, name: str) -> Any:
         return getattr(self.__dataclass__, name)
 
+    def __setattr__(self, __name: str, __value: Any) -> None:
+        return setattr(self.__dataclass__, __name, __value)
+
     def __instancecheck__(self, instance: Any) -> bool:
         return isinstance(instance, self.__dataclass__)
 


Test patch:
diff --git a/tests/test_dataclasses.py b/tests/test_dataclasses.py
--- a/tests/test_dataclasses.py
+++ b/tests/test_dataclasses.py
@@ -1472,3 +1472,19 @@ def __post_init__(self):
             self.a *= 3
 
     assert C().a == 6  # 1 * 3 + 3
+
+
+def test_dataclass_setattr():
+    class Foo:
+        bar: str = 'cat'
+
+    default_config = dataclasses.make_dataclass(
+        cls_name=Foo.__name__,
+        bases=(dataclasses.dataclass(Foo),),
+        fields=[('bar', ClassVar[str], dataclasses.field(default=Foo.bar))],
+    )
+
+    config = pydantic.dataclasses.dataclass(default_config)
+    assert config.bar == 'cat'
+    setattr(config, 'bar', 'dog')
+    assert config.bar == 'dog'