beamer, rowcolor, columncolor, line breaks in cell, and overlay

f:id:liephia:20171102143234p:plain

\documentclass[12pt,xcolor={dvipsnames,table}]{beamer}
\usepackage{booktabs}

\makeatletter
% columncolor > rowcolor https://tex.stackexchange.com/questions/80135
\def\tmpp#1\@addtopreamble#2#3!{%
    \tmp#2!{#1}{#3}}
\def\tmp#1\CT@column@color\CT@row@color#2!#3#4{%
\def\@classz{#3\@addtopreamble{#1\CT@row@color\CT@column@color#2}#4}}
\expandafter\tmpp\@classz!
% get overlaynumber
\newcommand*{\overlaynumber}{\number\beamer@slideinframe}
\makeatother

\begin{document}

% tabular in cell for line break
\newcommand{\cellstack}[2][0]{
  \ifnum\overlaynumber=#1\newcolumntype{x}{>{\columncolor{red!20}}c}
  \else\newcolumntype{x}{c}\fi
  \def\arraystretch{0.9}\begin{tabular}[c]{@{}x@{}} #2 \end{tabular}
}
% change each column color
\newcommand{\onct}[2]{\newcolumntype{#1}{c}\only<#2>{\newcolumntype{#1}{>{\columncolor{red!20}}c}}}

\begin{frame}{Table}
  \centering
  \def\arraystretch{2.0}
  \onct{A}{2}\onct{B}{3}\onct{C}{4}\onct{D}{5}
  \rowcolors{2}{}{gray!20}
  \begin{tabular}{ABCD}
    \toprule
    Column1 & \cellstack{Column2 \\ Cat1} & \cellstack{Column3 \\ Cat2} & Column4 \\ \midrule
    \cellstack[2]{Row1 \\ Col1} & Row1 & Row1 & Row1 \\
    Row2 & \cellstack[3]{Row2 \\ Col2} & Row2 & \cellstack{Row2 \\ Col4} \\
    Row3 & Row3 & \cellstack[4]{Row3 \\ Col3} & \cellstack[5]{Row3 \\ Col4 \\ Row3inRow3} \\ \bottomrule
  \end{tabular}
\end{frame}

\end{document}

Please let me know if you know a better way...