Utility function for getting a key from the given String-keyed map, attempting to cast it to the given generic type, T. Will insert and return the provided default value if they key is missing or the value cannot be cast.
Note: This function does not support maps with nullable values.