You can do this by redefining the accent macros only for mathmode, using the
\everydisplay token lists. You can do this as follows:
% Create a token list for your custom math accent macros
% The following adds your custom macros for math accents
% to both inline and displayed math mode
This should also preserve the normal meanings of the accent macros for text mode. — Note that for the other part of your question: there is no mechanism to define a new macro to accept an argument which immediately precedes it, as in the examples you give.