The vision of the upcoming 6G technologies that have fast data rate, low latency, and ultra-dense network, draws great attentions to the Internet of Vehicles (IoV) and Vehicle-to-Everything (V2X) communication for intelligent transportation systems. There is an urgent need for distributed machine learning techniques that can take advantages of massive interconnected networks with explosive amount of heterogeneous data generated at the network edge. In this study, a two-layer federated learning model is proposed to take advantages of the distributed end-edge-cloud architecture typical in 6G environment, and to achieve a more efficient and more accurate learning while ensuring data privacy protection and reducing communication overheads. A novel multi-layer heterogeneous model selection and aggregation scheme is designed as a part of the federated learning process to better utilize the local and global contexts of individual vehicles and road side units (RSUs) in 6G supported vehicular networks. This context-aware distributed learning mechanism is then developed and applied to address intelligent object detection, which is one of the most critical challenges in modern intelligent transportation systems with autonomous vehicles. Evaluation results showed that the proposed method, which demonstrates a higher learning accuracy with better precision, recall and F1 score, outperforms other state-of-the-art methods under 6G network configuration by achieving faster convergence, and scales better with larger numbers of RSUs involved in the learning process.