BUG: pivot_table not returning correct type when margin=True and aggfunc='mean' 
- [x] closes #24893
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

# What's new
Use of `maybe_downcast_to_dtype` in `_add_margins` so it can resolve the dtype conversion, avoiding floats being converted to integers when the result of the `aggfunc` is a float.

For the new case, if after applying the aggfunc,  if the margin result is not an integer, the whole column is converted to float:

Example:

```
_df
   A  B  C  D
0  2  1  1  X
1  4  4  3  X
2  6  5  4  Y
3  8  8  6  Y
```

Currently pandas does this:

```
print(pd.pivot_table(_df, index="D", margins=True))                                                              
     A    B  C
D             
X    3  2.5  2
Y    7  6.5  5
All  5  4.5  3

```

with the fix the result is:

```
print(pd.pivot_table(_df, index="D", margins=True))                                                              
     A    B  C
D             
X    3  2.5  2.0
Y    7  6.5  5.0
All  5  4.5  3.5

```

# Issues
There are test referencing that np.means of ints are casted back into ints. However, giving that for the aggregations in the rows, floats are kept when the np.mean of integers is a float, it does not make sense that this behavior does not hold for the margins.